static File createNewFile ( final FileLogSet fileLogSet ) { final File directory = fileLogSet . getDirectory ( ) ; final String fileName = fileLogSet . getFileName ( ) ; final String fileExtension = fileLogSet . getFileExtension ( ) ; File f = null ; try { f = AccessController . doPrivileged ( new java . security . PrivilegedExceptionAction < File > ( ) { @ Override public File run ( ) throws Exception { return fileLogSet . createNewFile ( ) ; } } ) ; } catch ( PrivilegedActionException e ) { File exf = new File ( directory , fileName + fileExtension ) ; Tr . error ( tc , "UNABLE_TO_DELETE_RESOURCE" , new Object [ ] { exf . getAbsolutePath ( ) , e } ) ; } return f ; }
This method will create a new file with the specified name and extension in the specified directory . If a unique file is required then it will add a timestamp to the file and if necessary a unqiue identifier to the file name .