Buggy code:
public class JMeterThread implements Serializable , Runnable { private static transient Logger log = LoggingManager . getLoggerForClass ( ) ; private int initialDelay = 0 ; private Controller controller ; private boolean running ; private HashTree testTree ; private transient TestCompiler compiler ; private JMeterThreadMonitor monitor ; private String threadName ; private transient JMeterContext threadContext ; private transient JMeterVariables threadVars ; private Collection testListeners ; private transient ListenerNotifier notifier ; private int threadNum = 0 ; private long startTime = 0 ; private long endTime = 0 ; private boolean scheduler = false ; private ThreadGroup threadGroup ; private StandardJMeterEngine engine = null ; private boolean onErrorStopTest ; private boolean onErrorStopThread ; public static final String PACKAGE_OBJECT = "JMeterThread.pack" ; public static final String LAST_SAMPLE_OK = "JMeterThread.last_sample_ok" ; public JMeterThread ( ) { } public JMeterThread ( HashTree test , JMeterThreadMonitor monitor , ListenerNotifier note ) { } public void setInitialContext ( JMeterContext context ) { } public boolean isScheduled ( ) { } public void setScheduled ( boolean sche ) { } public void setStartTime ( long stime ) { } public long getStartTime ( ) { } public void setEndTime ( long etime ) { } public long getEndTime ( ) { } private void stopScheduler ( ) { } private void startScheduler ( ) { } public void setThreadName ( String threadName ) { } private static final boolean startEarlier = JMeterUtils . getPropDefault ( "jmeterthread.startearlier" , true ) ; public void run ( ) { } protected void initRun ( ) { } private void threadStarted ( ) { } private void threadFinished ( ) { } private static class Traverser implements HashTreeTraverser { private boolean isStart = false ; private Traverser ( boolean start ) { } public void addNode ( Object node , HashTree subTree ) { } public void subtractNode ( ) { } public void processPath ( ) { } } public String getThreadName ( ) { } public void stop ( ) { } private void stopTest ( ) { } private void stopThread ( ) { } public void pauseThread ( int milis ) { } private void checkAssertions ( List assertions , SampleResult result ) { } private void runPostProcessors ( List extractors ) { } private void delay ( List timers ) { <START_BUG> int sum = 0 ; <END_BUG> Iterator iter = timers . iterator ( ) ; while ( iter . hasNext ( ) ) { Timer timer = ( ( Timer ) ( iter . next ( ) ) ) ; TestBeanHelper . prepare ( ( ( TestElement ) ( timer ) ) ) ; sum += timer . delay ( ) ; } if ( sum > 0 ) { try { Thread . sleep ( sum ) ; } catch ( InterruptedException e ) { JMeterThread . log . error ( "" , e ) ; } } } private void notifyTestListeners ( ) { } private void notifyListeners ( List listeners , SampleResult result ) { } public void setInitialDelay ( int delay ) { } private void rampUpDelay ( ) { } public int getThreadNum ( ) { } public void setThreadNum ( int threadNum ) { } private class IterationListener implements LoopIterationListener { public void iterationStart ( LoopIterationEvent iterEvent ) { } } public void setEngine ( StandardJMeterEngine engine ) { } public void setOnErrorStopTest ( boolean b ) { } public void setOnErrorStopThread ( boolean b ) { } public ThreadGroup getThreadGroup ( ) { } public void setThreadGroup ( ThreadGroup group ) { } }

Fix:
long sum = 0 ;