Program: 96160
Project: 96160
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void startTestJob(ITestJobPO testJob,Locale locale,boolean autoScreenshot){
  TestExecution.getInstance().setStartedTestJob(testJob);
  m_testjobStartTime=new Date();
  try {
    final AtomicBoolean isTestExecutionFailed=new AtomicBoolean(false);
    final AtomicInteger testExecutionMessageId=new AtomicInteger(0);
    final AtomicInteger testExecutionState=new AtomicInteger(0);
    final AtomicBoolean isTestExecutionFinished=new AtomicBoolean(false);
    ITestExecutionEventListener executionListener=new ITestExecutionEventListener(){
      /** 
 * {@inheritDoc} 
 */
      public void stateChanged(      TestExecutionEvent event){
        testExecutionState.set(event.getState());
        if (event.getState() == TestExecutionEvent.TEST_EXEC_FAILED) {
          if (event.getException() instanceof JBException) {
            JBException e=(JBException)event.getException();
            testExecutionMessageId.set(e.getErrorId());
          }
          isTestExecutionFailed.set(true);
          testExecutionFinished();
        }
      }
      /** 
 * {@inheritDoc} 
 */
      public void endTestExecution(){
        testExecutionFinished();
      }
      private void testExecutionFinished(){
        isTestExecutionFinished.set(true);
        removeTestExecutionEventListener(this);
      }
    }
;
    List<INodePO> refTestSuiteList=testJob.getUnmodifiableNodeList();
    for (    INodePO node : refTestSuiteList) {
      IRefTestSuitePO refTestSuite=(IRefTestSuitePO)node;
      isTestExecutionFailed.set(false);
      isTestExecutionFinished.set(false);
      addTestExecutionEventListener(executionListener);
      AutIdentifier autId=new AutIdentifier(refTestSuite.getTestSuiteAutID());
      String testSuiteGuid=refTestSuite.getTestSuiteGuid();
      ITestSuitePO testSuite=NodePM.getTestSuite(testSuiteGuid);
      startTestSuite(testSuite,locale,autId,autoScreenshot);
      while (!isTestExecutionFinished.get()) {
        try {
          Thread.sleep(500);
        }
 catch (        InterruptedException e) {
        }
      }
      if (!continueTestJobExecution(testExecutionState,testExecutionMessageId)) {
        break;
      }
    }
  }
  finally {
    TestExecution.getInstance().setStartedTestJob(null);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void startTestJob(ITestJobPO testJob,Locale locale,boolean autoScreenshot){
  TestExecution.getInstance().setStartedTestJob(testJob);
  m_testjobStartTime=new Date();
  try {
    final AtomicBoolean isTestExecutionFailed=new AtomicBoolean(false);
    final AtomicInteger testExecutionMessageId=new AtomicInteger(0);
    final AtomicInteger testExecutionState=new AtomicInteger(0);
    final AtomicBoolean isTestExecutionFinished=new AtomicBoolean(false);
    ITestExecutionEventListener executionListener=new ITestExecutionEventListener(){
      /** 
 * {@inheritDoc} 
 */
      public void stateChanged(      TestExecutionEvent event){
        testExecutionState.set(event.getState());
        if (event.getState() == TestExecutionEvent.TEST_EXEC_FAILED) {
          if (event.getException() instanceof JBException) {
            JBException e=(JBException)event.getException();
            testExecutionMessageId.set(e.getErrorId());
          }
          isTestExecutionFailed.set(true);
          testExecutionFinished();
        }
      }
      /** 
 * {@inheritDoc} 
 */
      public void endTestExecution(){
        testExecutionFinished();
      }
      private void testExecutionFinished(){
        isTestExecutionFinished.set(true);
        removeTestExecutionEventListener(this);
      }
    }
;
    List<INodePO> refTestSuiteList=testJob.getUnmodifiableNodeList();
    for (    INodePO node : refTestSuiteList) {
      IRefTestSuitePO refTestSuite=(IRefTestSuitePO)node;
      isTestExecutionFailed.set(false);
      isTestExecutionFinished.set(false);
      addTestExecutionEventListener(executionListener);
      AutIdentifier autId=new AutIdentifier(refTestSuite.getTestSuiteAutID());
      String testSuiteGuid=refTestSuite.getTestSuiteGuid();
      ITestSuitePO testSuite=NodePM.getTestSuite(testSuiteGuid);
      startTestSuite(testSuite,locale,autId,autoScreenshot);
      while (!isTestExecutionFinished.get()) {
        TimeUtil.delay(500);
      }
      if (!continueTestJobExecution(testExecutionState,testExecutionMessageId)) {
        break;
      }
    }
  }
  finally {
    TestExecution.getInstance().setStartedTestJob(null);
  }
}