Buggy code:
public class OptimizationRepeatability < T > { public enum MissingSwitch { Median , Search ; } private static final OptimizationRepeatability . MissingSwitch missingSwitch = OptimizationRepeatability . MissingSwitch . Median ; private static int MaxRepeatability = 10 ; private static final double OverlapError = 5.0 ; private TileGrid < ImageTile < T > > grid ; private JProgressBar progressBar ; private int userDefinedRepeatability ; private boolean isUserDefinedRepeatability ; private double userDefinedHorizontalOverlap ; private double userDefinedVerticalOverlap ; private double userDefinedOverlapError ; private StitchingAppParams params ; private List < OptimizationRepeatabilityWorker < T > > optimizationWorkers ; private List < Thread > executionThreads ; private volatile boolean isCancelled ; public OptimizationRepeatability ( TileGrid < ImageTile < T > > grid , JProgressBar progressBar , StitchingAppParams params ) { } public void computeGlobalOptimizationRepeatablity ( ) throws GlobalOptimizationException { StitchingGuiUtils . updateProgressBar ( this . progressBar , true , "Computing<seq2seq4repair_space>Repeatability" , "Optimization..." , 0 , 0 , 0 , false ) ; <START_BUG> File directory = new File ( this . params . getOutputParams ( ) . getOutputPath ( ) ) ; <END_BUG> directory . mkdirs ( ) ; File preOptPosFile = this . params . getOutputParams ( ) . getRelPosNoOptFile ( currentTimeSlice ) ; Stitching . outputRelativeDisplacementsNoOptimization ( this . grid , preOptPosFile ) ; double percOverlapError = OptimizationRepeatability . OverlapError ; if ( ! ( Double . isNaN ( this . userDefinedOverlapError ) ) ) percOverlapError = this . userDefinedOverlapError ; int computedRepeatability ; int repeatabilityNorth = correctTranslationsModel ( percOverlapError , North ) ; int repeatabilityWest = correctTranslationsModel ( percOverlapError , West ) ; File hillClimbPosFile = this . params . getOutputParams ( ) . getHillClimbPositionFile ( currentTimeSlice ) ; Stitching . outputRelativeDisplacements ( this . grid , hillClimbPosFile ) ; computedRepeatability = ( repeatabilityNorth > repeatabilityWest ) ? repeatabilityNorth : repeatabilityWest ; if ( this . isUserDefinedRepeatability ) { computedRepeatability = this . userDefinedRepeatability ; } if ( this . isCancelled ) { return ; } computedRepeatability = ( 2 * computedRepeatability ) + 1 ; Log . msg ( HELPFUL , ( "Calculated<seq2seq4repair_space>Repeatability:<seq2seq4repair_space>" + computedRepeatability ) ) ; StitchingGuiUtils . updateProgressBar ( this . progressBar , false , null , "Optimization..." , 0 , ( ( this . grid . getExtentHeight ( ) ) * ( this . grid . getExtentWidth ( ) ) ) , 0 , false ) ; if ( ImageTile . freePixelData ( ) ) { for ( int r = 0 ; r < ( this . grid . getExtentHeight ( ) ) ; r ++ ) { for ( int c = 0 ; c < ( this . grid . getExtentWidth ( ) ) ; c ++ ) { this . grid . getSubGridTile ( r , c ) . resetPixelReleaseCount ( this . grid . getExtentWidth ( ) , this . grid . getExtentHeight ( ) , this . grid . getStartRow ( ) , this . grid . getStartCol ( ) ) ; } } } int numThreads = Runtime . getRuntime ( ) . availableProcessors ( ) ; this . executionThreads = new ArrayList < Thread > ( ) ; this . optimizationWorkers = new ArrayList < OptimizationRepeatabilityWorker < T > > ( ) ; TileGridTraverser < ImageTile < T > > traverser = TileGridTraverserFactory . makeTraverser ( DIAGONAL , this . grid ) ; BlockingQueue < ImageTile < T > > queue = new ArrayBlockingQueue < ImageTile < T > > ( this . grid . getSubGridSize ( ) ) ; for ( ImageTile < T > tile : traverser ) { queue . add ( tile ) ; } for ( int i = 0 ; i < numThreads ; i ++ ) { OptimizationRepeatabilityWorker < T > worker ; worker = new OptimizationRepeatabilityWorker < T > ( queue , this . grid , computedRepeatability , this . progressBar ) ; this . optimizationWorkers . add ( worker ) ; this . executionThreads . add ( new Thread ( worker ) ) ; } for ( Thread thread : this . executionThreads ) thread . start ( ) ; for ( Thread thread : this . executionThreads ) { try { thread . join ( ) ; } catch ( InterruptedException e ) { Log . msg ( MANDATORY , e . getMessage ( ) ) ; } } } public void cancelOptimization ( ) { } public int correctTranslationsModel ( double percOverlapError , Direction dir ) throws GlobalOptimizationException { } }

Fix:
File directory = new File ( this . params . getOutputParams ( ) . getMetadataPath ( ) ) ;