Program: 137845
Project: 137845
Buggy source:
/** 
 * DOC xqliu Comment method "runAnalysisIndicatorsParallel".
 * @param analysis
 * @param elementToIndicator
 * @param indicators
 * @param pooledConnection
 * @return
 * @throws SQLException
 */
private boolean runAnalysisIndicatorsParallel(Analysis analysis,Map<ModelElement,List<Indicator>> elementToIndicator,List<Indicator> indicators,boolean pooledConnection) throws SQLException {
  resetConnectionPool(analysis);
  List<ExecutiveAnalysisJob> excuteAnalysisJober=new ArrayList<ExecutiveAnalysisJob>();
  try {
    List<ExecutiveAnalysisJob> jobs=new ArrayList<ExecutiveAnalysisJob>();
    this.getMonitor().beginTask("String_Node_Str",100);
    int temp=0;
    for (int i=0; i < indicators.size(); i++) {
      Indicator indicator=indicators.get(i);
      if (this.continueRun()) {
        this.getMonitor().setTaskName(Messages.getString("String_Node_Str") + indicator.getAnalyzedElement().getName());
        Connection conn=null;
        if (pooledConnection) {
          conn=getPooledConnection(analysis).getObject();
        }
 else {
          conn=getConnection(analysis).getObject();
        }
        if (conn != null) {
          ExecutiveAnalysisJob eaj=new ExecutiveAnalysisJob(ColumnAnalysisSqlExecutor.this,conn,elementToIndicator,indicator);
          excuteAnalysisJober.add(eaj);
          eaj.schedule();
          jobs.add(eaj);
          if (this.continueRun()) {
            eaj.join();
          }
          if (eaj.errorMessage != null) {
            ColumnAnalysisSqlExecutor.this.errorMessage=eaj.errorMessage;
            ColumnAnalysisSqlExecutor.this.parallelExeStatus=false;
          }
        }
        int current=(i + 1) * 100 / indicators.size();
        if (current > temp) {
          this.getMonitor().worked(current - temp);
          temp=current;
        }
      }
    }
    this.getMonitor().done();
  }
 catch (  Throwable thr) {
    log.error(thr);
  }
 finally {
    resetConnectionPool(analysis);
  }
  return parallelExeStatus;
}

Fixed version (ground truth):
/** 
 * DOC xqliu Comment method "runAnalysisIndicatorsParallel".
 * @param analysis
 * @param elementToIndicator
 * @param indicators
 * @param pooledConnection
 * @return
 * @throws SQLException
 */
private boolean runAnalysisIndicatorsParallel(Analysis analysis,Map<ModelElement,List<Indicator>> elementToIndicator,List<Indicator> indicators,boolean pooledConnection) throws SQLException {
  resetConnectionPool(analysis);
  List<ExecutiveAnalysisJob> excuteAnalysisJober=new ArrayList<ExecutiveAnalysisJob>();
  try {
    List<ExecutiveAnalysisJob> jobs=new ArrayList<ExecutiveAnalysisJob>();
    this.getMonitor().beginTask("String_Node_Str",100);
    int temp=0;
    for (int i=0; i < indicators.size(); i++) {
      Indicator indicator=indicators.get(i);
      if (this.continueRun()) {
        this.getMonitor().setTaskName(Messages.getString("String_Node_Str") + "String_Node_Str" + indicator.getAnalyzedElement().getName());
        Connection conn=null;
        if (pooledConnection) {
          conn=getPooledConnection(analysis).getObject();
        }
 else {
          conn=getConnection(analysis).getObject();
        }
        if (conn != null) {
          ExecutiveAnalysisJob eaj=new ExecutiveAnalysisJob(ColumnAnalysisSqlExecutor.this,conn,elementToIndicator,indicator);
          excuteAnalysisJober.add(eaj);
          eaj.schedule();
          jobs.add(eaj);
          if (this.continueRun()) {
            eaj.join();
          }
          if (eaj.errorMessage != null) {
            ColumnAnalysisSqlExecutor.this.errorMessage=eaj.errorMessage;
            ColumnAnalysisSqlExecutor.this.parallelExeStatus=false;
          }
        }
        int current=(i + 1) * 100 / indicators.size();
        if (current > temp) {
          this.getMonitor().worked(current - temp);
          temp=current;
        }
      }
    }
    this.getMonitor().done();
  }
 catch (  Throwable thr) {
    log.error(thr);
  }
 finally {
    resetConnectionPool(analysis);
  }
  return parallelExeStatus;
}