Buggy code:
public class MetFragPreCalculatedGC { public static FragmenterResult results = new FragmenterResult ( ) ; private String file = "" ; private String date = "" ; private long timeStart ; private int candidateCount = 0 ; public MetFragPreCalculatedGC ( String file , String date ) { } public void startScriptable ( boolean useProxy , boolean writeSDF , File folderToMopac , boolean getLowestHeatofFormation , WrapperSpectrum spectrum ) throws Exception { MetFragPreCalculatedGC . results = new FragmenterResult ( ) ; Config config = new Config ( "outside" ) ; String database = config . getDatabase ( ) ; List < CMLMolecule > candidates = new ArrayList < CMLMolecule > ( ) ; if ( getLowestHeatofFormation ) { candidates = CMLTools . readFoldersLowestHoF ( folderToMopac ) ; for ( CMLMolecule cmlmol : candidates ) { System . out . println ( cmlmol . getFileName ( ) ) ; } } else candidates = CMLTools . readFolder ( folderToMopac ) ; String correctCandidateID = getCorrectCandidateID ( candidates ) ; MetFragPreCalculatedGC . results . addToCompleteLog ( "\n*****************************************************\n\n" ) ; MetFragPreCalculatedGC . results . addToCompleteLog ( ( ( ( "\nFile:<seq2seq4repair_space>" + ( file ) ) + "<seq2seq4repair_space>====><seq2seq4repair_space>" ) + correctCandidateID ) ) ; int threads = Runtime . getRuntime ( ) . availableProcessors ( ) ; ExecutorService threadExecutor = null ; System . out . println ( ( "Used<seq2seq4repair_space>Threads:<seq2seq4repair_space>" + threads ) ) ; threadExecutor = Executors . newFixedThreadPool ( threads ) ; for ( int c = 0 ; c < ( candidates . size ( ) ) ; c ++ ) { <START_BUG> FragmenterThread ft = new FragmenterThread ( candidates . get ( c ) . getMolStructure ( ) , candidates . get ( c ) . getFileName ( ) , database , new PubChemWebService ( ) , spectrum , 0.5 , 10 , config . isSumFormulaRedundancyCheck ( ) , config . isBreakAromaticRings ( ) , config . getTreeDepth ( ) , false , config . isHydrogenTest ( ) , config . isNeutralLossAdd ( ) , config . isBondEnergyScoring ( ) , config . isOnlyBreakSelectedBonds ( ) , config , true , config . getMaximumNeutralLossCombination ( ) , true ) ; <END_BUG> ft . setGC ( true ) ; threadExecutor . execute ( ft ) ; } threadExecutor . shutdown ( ) ; int count = 0 ; while ( ! ( threadExecutor . isTerminated ( ) ) ) { try { Thread . sleep ( 5000 ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } if ( count == 1000 ) System . err . println ( "ThreadExecutor<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>terminated!" ) ; else Thread . sleep ( 5000 ) ; count ++ ; } evaluateResults ( correctCandidateID , spectrum , true , config . getFolder ( ) , writeSDF ) ; } private String getCorrectCandidateID ( List < CMLMolecule > candidates ) { } private void writeSDF ( Double [ ] keysScore , String folder , String correctCandidateID ) { } private void evaluateResults ( String correctCandidateID , WrapperSpectrum spectrum , boolean generateOptimizationMatrix , String folder , boolean writeSDF ) throws InterruptedException { } private String prepareParameterOptimizationMatrix ( String pubChemIdentifier , Double exactMass ) { } private String generateOptimizationMatrix ( Map < String , List < OptimizationMatrixEntry > > candidateToOptimizationMatrixEntries , String header ) { } private String prepareParameterOptimizationMatrixCombined ( String pubChemIdentifier , Double exactMass ) { } private String generateOptimizationMatrixCombined ( Map < String , List < OptimizationMatrixEntry > > candidateToOptimizationMatrixEntries , String header ) { } public static void main ( String [ ] args ) { } }

Fix:
FragmenterThread ft = new FragmenterThread ( candidates . get ( c ) . getMolStructure ( ) , candidates . get ( c ) . getFileName ( ) , database , new PubChemWebService ( ) , spectrum , 0.5 , 0 , config . isSumFormulaRedundancyCheck ( ) , config . isBreakAromaticRings ( ) , config . getTreeDepth ( ) , false , config . isHydrogenTest ( ) , config . isNeutralLossAdd ( ) , config . isBondEnergyScoring ( ) , config . isOnlyBreakSelectedBonds ( ) , config , true , config . getMaximumNeutralLossCombination ( ) , true ) ;