Jim,
 
You might just want to change the code to create and close a FileOutputStream 
in a way that doesn't truncate or damage the target file.  Or maybe use the NIO 
file code if that is possible.  See BUG ID 4420020.
 
Jason
 

> Date: Fri, 9 Nov 2012 16:37:02 -0500
> From: jim.g...@oracle.com
> To: core-libs-dev@openjdk.java.net
> Subject: RFR: 6244047: impossible to specify directories to logging 
> FileHandler unless they exist
> 
> Please review 
> http://cr.openjdk.java.net/~jgish/Bug6244047-FileHandler-CheckLockLocation/ 
> <http://cr.openjdk.java.net/%7Ejgish/Bug6244047-FileHandler-CheckLockLocation/>
> 
> This updates the logging FileHandler to actually check the directory 
> passed to it via the pattern to ensure that it exists and is writable. 
> It does this before going into the loop to create lock files there which 
> will fail repeatedly if the directory specified is invalid. If the file 
> specified does not exist, or is not a directory or not writable, an 
> IOException with a precise message is thrown.
> 
> Note that this fix does not do as some users would like, which is to go 
> ahead and create directories that don't exist.
> 
> Thanks,
> Jim
> 
> -- 
> Jim Gish | Consulting Member of Technical Staff | +1.781.442.0304
> Oracle Java Platform Group | Core Libraries Team
> 35 Network Drive
> Burlington, MA 01803
> jim.g...@oracle.com
> 
                                          

Reply via email to