public static File ensureDirectoryWriteable ( File logDir ) throws FileNotFoundException { try { FileUtils . forceMkdir ( logDir ) ; } catch ( IOException e ) { log . debug ( "Failed to create directory " + logDir , e ) ; throw new FileNotFoundException ( "Failed to create directory: " + logDir + " IOException: " + e . getMessage ( ) ) ; } if ( ! logDir . canWrite ( ) ) { log . debug ( "Init param log dir cannot be used!" ) ; throw new FileNotFoundException ( "Directory is not writable: " + logDir ) ; } return logDir ; }
Try s to create a directory and ensures that it is writable .