This is the mail archive of the
java-patches@sources.redhat.com
mailing list for the Java project.
Re: Patch: File.createTempFile fixes
- To: green at cygnus dot com
- Subject: Re: Patch: File.createTempFile fixes
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 04 Sep 2000 14:39:36 -0600
- Cc: java-patches at sources dot redhat dot com
- References: <200009042011.NAA05993@decepticon.cygnus.com>
- Reply-To: tromey at cygnus dot com
Anthony> This patch sets the java.io.tmpdir property based on the
Anthony> TMPDIR environment variable.
Cool, thanks.
Anthony> The 1.3 docs says that createTempFile throws an exception if
Anthony> "a security manager exists and its
Anthony> SecurityManager.checkWrite(java.io.FileDescriptor) method
Anthony> does not allow a file to be created". I'm confused. Doesn't
Anthony> the fact that we have a FileDescriptor mean the file has been
Anthony> created already?
I don't understand this either.
I think your approach is reasonable.
I don't think there's any need to synchronize on tmpdir in the method.
We're just as likely to be racing against some other process. That
means we need to handle synchronization by using an atomic open
operation.
We almost do this right now, using FileDescriptor.EXCL. However I
don't think we can currently detect when FileDescriptor.open fails
due to EEXIST as opposed to any other sort of error. Yuck.
Tom