Buggy code:
public class CloneDigger { private static void displayError ( ArrayList < String > errorList ) { } public static void main ( String [ ] args ) throws IOException { Options options = new Options ( ) ; options . addOption ( "generateBaseline" , true , "generate<seq2seq4repair_space>baseline<seq2seq4repair_space>config<seq2seq4repair_space>file<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>provided<seq2seq4repair_space>path" ) ; options . addOption ( "loadConfig" , true , "configuration<seq2seq4repair_space>xml<seq2seq4repair_space>file<seq2seq4repair_space>path" ) ; CommandLineParser parser = new DefaultParser ( ) ; String baseLineOutputPath = null ; String loadConfig = null ; try { CommandLine cmd = parser . parse ( options , args ) ; if ( cmd . hasOption ( "loadConfig" ) ) { loadConfig = cmd . getOptionValue ( "loadConfig" ) ; } if ( cmd . hasOption ( "generateBaseline" ) ) { baseLineOutputPath = cmd . getOptionValue ( "generateBaseline" ) ; } } catch ( ParseException e ) { System . out . println ( e ) ; } if ( baseLineOutputPath != null ) { System . out . println ( "Writing<seq2seq4repair_space>baseline<seq2seq4repair_space>config<seq2seq4repair_space>file.." ) ; ConfigFile . writeBaseline ( baseLineOutputPath ) ; System . out . println ( "Exiting." ) ; System . exit ( 0 ) ; } ConfigFile config = new ConfigFile ( ) ; config . loadConfig ( loadConfig ) ; int gapSize = config . gapSize ; int matchAlgorithm = config . matchAlgorithm ; int matchMode = config . matchMode ; int minNumLines = config . minNumLines ; String databaseDir = config . database ; String projectDir = config . project ; boolean debug = config . debug ; boolean removeEmpty = config . removeEmpty ; boolean buildDatabase = config . buildDatabase ; String resultPath = config . resultPath ; boolean exportResults = config . exportResults ; boolean loadResults = config . loadResults ; int similarityRange = config . similarityRange ; boolean enableSimilarity = config . enableSimilarity ; boolean enableRepetitive = config . enableRepetitive ; boolean enableOneMethod = config . enableOneMethod ; boolean buildTFIDF = config . buildTFIDF ; boolean loadDatabaseFilePaths = config . loadDatabaseFilePaths ; System . out . println ( "Finished<seq2seq4repair_space>parsing<seq2seq4repair_space>XML<seq2seq4repair_space>parameters" ) ; SimpleDateFormat sdf = new SimpleDateFormat ( "hh:mm:ss<seq2seq4repair_space>a" ) ; Calendar cal = Calendar . getInstance ( ) ; System . out . println ( ( "Start<seq2seq4repair_space>@<seq2seq4repair_space>" + ( sdf . format ( cal . getTime ( ) ) ) ) ) ; long startTime = System . nanoTime ( ) ; String databaseFilePaths = databaseDir + "cachedList.tmp" ; File f = new File ( databaseFilePaths ) ; List < String > databaseFileList ; <START_BUG> if ( ( ( f . exists ( ) ) && ( ! ( f . isDirectory ( ) ) ) ) && ( loadDatabaseFilePaths == false ) ) { <END_BUG> databaseFileList = Database . loadFileList ( databaseFilePaths ) ; } else { databaseFileList = Database . generateFileList ( databaseDir , databaseFilePaths ) ; } TermFrequency termFreq = new TermFrequency ( ) ; if ( buildTFIDF == true ) { termFreq . buildFrequencyMap ( databaseDir ) ; } else { } ArrayList < String > errorList = new ArrayList < String > ( ) ; Output output = new Output ( matchAlgorithm , enableRepetitive , enableOneMethod ) ; if ( matchMode == 1 ) { if ( loadResults == false ) { System . out . println ( "Mode:<seq2seq4repair_space>full<seq2seq4repair_space>mesh" ) ; ArrayList < Text > database_TextList = new ArrayList < Text > ( ) ; if ( buildDatabase ) { ArrayList < String > temp = Database . constructCache ( minNumLines , debug , databaseFileList , databaseDir ) ; errorList . addAll ( temp ) ; } System . out . println ( ( ( ( "\nLoading<seq2seq4repair_space>a<seq2seq4repair_space>total<seq2seq4repair_space>of<seq2seq4repair_space>" + ( databaseFileList . size ( ) ) ) + "<seq2seq4repair_space>cached<seq2seq4repair_space>database<seq2seq4repair_space>files<seq2seq4repair_space>from<seq2seq4repair_space>\n" ) + databaseDir ) ) ; Database . loadCache ( database_TextList , debug , databaseFileList , databaseDir ) ; cal = Calendar . getInstance ( ) ; System . out . println ( ( "Start<seq2seq4repair_space>comparison<seq2seq4repair_space>@<seq2seq4repair_space>" + ( sdf . format ( cal . getTime ( ) ) ) ) ) ; Compare comp = new Compare ( minNumLines ) ; comp . installTextFiles ( database_TextList ) ; comp . detectClones_Within ( output , matchAlgorithm , gapSize ) ; if ( exportResults ) { output . saveResults ( resultPath ) ; } } else { if ( exportResults ) { output . loadResults ( resultPath ) ; } } output . printResults ( removeEmpty , similarityRange , enableSimilarity , matchMode ) ; } else { if ( loadResults == false ) { System . out . println ( "Mode:<seq2seq4repair_space>between<seq2seq4repair_space>comparison" ) ; ArrayList < Text > db_TextList = new ArrayList < Text > ( ) ; ArrayList < Text > project_TextList = new ArrayList < Text > ( ) ; List < String > projectFilePaths = Database . getFileList ( projectDir ) ; ArrayList < String > temp ; temp = Database . constructCache ( minNumLines , debug , projectFilePaths , projectDir ) ; errorList . addAll ( temp ) ; if ( buildDatabase ) { temp = Database . constructCache ( minNumLines , debug , databaseFileList , databaseDir ) ; errorList . addAll ( temp ) ; } System . out . println ( ( ( ( "\nLoading<seq2seq4repair_space>a<seq2seq4repair_space>total<seq2seq4repair_space>of<seq2seq4repair_space>" + ( projectFilePaths . size ( ) ) ) + "<seq2seq4repair_space>cached<seq2seq4repair_space>project<seq2seq4repair_space>files<seq2seq4repair_space>from<seq2seq4repair_space>\n" ) + projectDir ) ) ; Database . loadCache ( project_TextList , debug , projectFilePaths , projectDir ) ; cal = Calendar . getInstance ( ) ; System . out . println ( ( "Start<seq2seq4repair_space>comparison<seq2seq4repair_space>@<seq2seq4repair_space>" + ( sdf . format ( cal . getTime ( ) ) ) ) ) ; Compare comp = new Compare ( minNumLines ) ; comp . installTextFiles ( project_TextList , databaseFileList ) ; comp . detectClones_Between ( output , matchAlgorithm , gapSize , databaseDir ) ; if ( exportResults ) { output . saveResults ( resultPath ) ; } } else { if ( exportResults ) { output . loadResults ( resultPath ) ; } } output . printResults ( removeEmpty , similarityRange , enableSimilarity , matchMode ) ; }

Fix:
if ( ( ( f . exists ( ) ) && ( ! ( f . isDirectory ( ) ) ) ) && ( loadDatabaseFilePaths == true ) ) {