Buggy code:
public class MagellanEngine { private static final int HARDWARE_ERROR_RETRIES = 6 ; private static final int DELWAY_BETWEEN_RETRIES_MS = 5 ; private static CMMCore core_ ; private AcquisitionEvent lastEvent_ = null ; private ExploreAcquisition currentExploreAcq_ ; private ParallelAcquisitionGroup currentFixedAcqs_ ; private MultipleAcquisitionManager multiAcqManager_ ; private ExecutorService acqExecutor_ ; public MagellanEngine ( CMMCore core ) { } private void validateSettings ( FixedAreaAcquisitionSettings settings ) throws Exception { } public void runFixedAreaAcquisition ( final FixedAreaAcquisitionSettings settings ) { } public synchronized ParallelAcquisitionGroup runInterleavedAcquisitions ( List < FixedAreaAcquisitionSettings > acqs , boolean multiAcq ) throws Exception { } public synchronized void runExploreAcquisition ( final ExploreAcqSettings settings ) { } private void runAcq ( final AcquisitionEventSource acq ) { } private void executeAcquisitionEvent ( AcquisitionEvent event ) throws InterruptedException { } private void acquireImage ( final AcquisitionEvent event ) throws InterruptedException { } private void setAutofocusPosition ( final String zName , final double pos ) throws InterruptedException { } private void updateHardware ( final AcquisitionEvent event ) throws InterruptedException { } private void loopHardwareCommandRetries ( MagellanEngine . HardwareCommand r , String commandName ) throws InterruptedException { } private String getCurrentDateAndTime ( ) { } public static void addImageMetadata ( JSONObject tags , AcquisitionEvent event , int timeIndex , int camChannelIndex , long elapsed_ms , int exposure ) { try { long gridRow = event . acquisition_ . getStorage ( ) . getGridRow ( event . positionIndex_ , 0 ) ; long gridCol = event . acquisition_ . getStorage ( ) . getGridCol ( event . positionIndex_ , 0 ) ; MD . setPositionName ( tags , ( ( ( "Grid_" + gridRow ) + "_" ) + gridCol ) ) ; MD . setPositionIndex ( tags , event . positionIndex_ ) ; MD . setSliceIndex ( tags , event . sliceIndex_ ) ; MD . setFrameIndex ( tags , timeIndex ) ; MD . setChannelIndex ( tags , ( ( event . channelIndex_ ) + camChannelIndex ) ) ; MD . setZPositionUm ( tags , event . zPosition_ ) ; <START_BUG> MD . setElapsedTimeMs ( tags , ( elapsed_ms - ( event . acquisition_ . getStartTime_ms ( ) ) ) ) ; <END_BUG> MD . setImageTime ( tags , new SimpleDateFormat ( "yyyy-MM-dd<seq2seq4repair_space>HH:mm:ss<seq2seq4repair_space>-" ) . format ( Calendar . getInstance ( ) . getTime ( ) ) ) ; MD . setGridRow ( tags , gridRow ) ; MD . setGridCol ( tags , gridCol ) ; MD . setStageX ( tags , event . xyPosition_ . getCenter ( ) . x ) ; MD . setStageY ( tags , event . xyPosition_ . getCenter ( ) . y ) ; } catch ( Exception e ) { Log . log ( "Problem<seq2seq4repair_space>adding<seq2seq4repair_space>image<seq2seq4repair_space>metadata" ) ; throw new RuntimeException ( ) ; } } public static JSONObject makeSummaryMD ( Acquisition acq , String prefix ) { } private interface HardwareCommand { void run ( ) throws Exception { } } public void setMultiAcqManager ( MultipleAcquisitionManager multiAcqManager ) { } }

Fix:
MD . setElapsedTimeMs ( tags , elapsed_ms ) ;