@ Override protected void prepareFileTypeAnalyzer ( Engine engine ) throws InitializationException { try { final File baseDir = getSettings ( ) . getTempDirectory ( ) ; tempFileLocation = File . createTempFile ( "check" , "tmp" , baseDir ) ; if ( ! tempFileLocation . delete ( ) ) { setEnabled ( false ) ; final String msg = String . format ( "Unable to delete temporary file '%s'." , tempFileLocation . getAbsolutePath ( ) ) ; throw new InitializationException ( msg ) ; } if ( ! tempFileLocation . mkdirs ( ) ) { setEnabled ( false ) ; final String msg = String . format ( "Unable to create directory '%s'." , tempFileLocation . getAbsolutePath ( ) ) ; throw new InitializationException ( msg ) ; } } catch ( IOException ex ) { setEnabled ( false ) ; throw new InitializationException ( "Unable to create a temporary file" , ex ) ; } }
Makes sure a usable temporary directory is available .