Program: 107776
Project: 107776
Buggy source:
@Override protected void doUpdate(final AnalysisContextClassification context){
  final StatisticsBuilderInterruptible builder=context.handle.getStatistics().getInterruptibleInstance();
  final String[] features=context.model.getSelectedFeatures().toArray(new String[0]);
  final String[] targetVariables=context.model.getSelectedClasses().toArray(new String[0]);
  final ARXClassificationConfiguration<?> config=context.model.getClassificationModel().getCurrentConfiguration();
  final ARXFeatureScaling scaling=context.model.getClassificationModel().getFeatureScaling();
  if (context.model.getSelectedFeatures().isEmpty() || context.model.getSelectedClasses().isEmpty()) {
    doReset();
    return;
  }
  Analysis analysis=new Analysis(){
    private boolean stopped=false;
    private List<List<Double>> values=new ArrayList<>();
    private int progress=0;
    @Override public int getProgress(){
      double result=0d;
      double perBatch=100d / (double)targetVariables.length;
      result+=(double)progress * perBatch;
      result+=(double)builder.getProgress() / 100d * perBatch;
      result=result <= 100d ? result : 100d;
      return (int)result;
    }
    @Override public void onError(){
      rocCurves.clear();
      originalRocCurves.clear();
      zerorRocCurves.clear();
      setStatusEmpty();
    }
    @Override public void onFinish(){
      if (stopped || !isEnabled() || getModel().getSelectedFeatures().isEmpty()|| getModel().getSelectedClasses().isEmpty()) {
        setStatusEmpty();
        return;
      }
      for (      final TableItem i : performancePerTargetTable.getItems()) {
        i.dispose();
      }
      for (int i=0; i < targetVariables.length; i++) {
        TableItem item=new TableItem(performancePerTargetTable,SWT.NONE);
        item.setText(0,targetVariables[i]);
        for (int j=0; j < values.get(i).size(); j++) {
          item.setData(String.valueOf(1 + j),values.get(i).get(j));
        }
      }
      String targetVariable=getModel().getSelectedAttribute();
      int targetIndex=getIndexOf(targetVariables,targetVariable);
      performancePerTargetTable.setFocus();
      performancePerTargetTable.select(targetIndex);
      updateOverview(performancePerTargetTable.getItem(targetIndex).getText());
      performanceRoot.layout();
      performanceSash.setWeights(new int[]{2,2});
      rocCombo.setItems(targetVariables);
      rocCombo.select(targetIndex);
      rocRoot.layout();
      rocSash.setWeights(new int[]{2,2});
      setStatusDone();
      folder.setSelection(0);
      if (performancePerTargetTable.getItemCount() != 0) {
        updateOverviewSelection(performancePerTargetTable.getItem(targetIndex).getText());
      }
      if (performancePerClassTable.getItemCount() != 0) {
        updateROCSelection(performancePerClassTable.getItem(0).getText(0));
      }
    }
    @Override public void onInterrupt(){
      if (!isEnabled() || getModel().getSelectedFeatures().isEmpty() || getModel().getSelectedClasses().isEmpty()) {
        setStatusEmpty();
      }
 else {
        setStatusWorking();
      }
    }
    @Override public void run() throws InterruptedException {
      long time=System.currentTimeMillis();
      rocCurves.clear();
      originalRocCurves.clear();
      zerorRocCurves.clear();
      for (      String targetVariable : targetVariables) {
        StatisticsClassification result=builder.getClassificationPerformance(features,targetVariable,config,scaling);
        progress++;
        if (stopped) {
          break;
        }
        values.add(getColumnValuesForOverallPerformanceTable(result));
        if (!originalRocCurves.containsKey(targetVariable)) {
          originalRocCurves.put(targetVariable,new HashMap<String,ROCCurve>());
          zerorRocCurves.put(targetVariable,new HashMap<String,ROCCurve>());
          rocCurves.put(targetVariable,new HashMap<String,ROCCurve>());
        }
        for (        String c : result.getClassValues()) {
          originalRocCurves.get(targetVariable).put(c,result.getOriginalROCCurve(c));
          zerorRocCurves.get(targetVariable).put(c,result.getZeroRROCCurve(c));
          if (result.getROCCurve(c) != null) {
            rocCurves.get(targetVariable).put(c,result.getROCCurve(c));
          }
        }
      }
      while (System.currentTimeMillis() - time < MINIMAL_WORKING_TIME && !stopped) {
        Thread.sleep(10);
      }
    }
    @Override public void stop(){
      builder.interrupt();
      this.stopped=true;
    }
  }
;
  this.manager.start(analysis);
}

Fixed version (ground truth):
@Override protected void doUpdate(final AnalysisContextClassification context){
  final StatisticsBuilderInterruptible builder=context.handle.getStatistics().getInterruptibleInstance();
  final String[] features=context.model.getSelectedFeatures().toArray(new String[0]);
  final String[] targetVariables=context.model.getSelectedClasses().toArray(new String[0]);
  final ARXClassificationConfiguration<?> config=context.model.getClassificationModel().getCurrentConfiguration();
  final ARXFeatureScaling scaling=context.model.getClassificationModel().getFeatureScaling();
  if (context.model.getSelectedFeatures().isEmpty() || context.model.getSelectedClasses().isEmpty()) {
    doReset();
    return;
  }
  Analysis analysis=new Analysis(){
    private boolean stopped=false;
    private List<List<Double>> values=new ArrayList<>();
    private int progress=0;
    @Override public int getProgress(){
      double result=0d;
      double perBatch=100d / (double)targetVariables.length;
      result+=(double)progress * perBatch;
      result+=(double)builder.getProgress() / 100d * perBatch;
      result=result <= 100d ? result : 100d;
      return (int)result;
    }
    @Override public void onError(){
      rocCurves.clear();
      originalRocCurves.clear();
      zerorRocCurves.clear();
      setStatusEmpty();
    }
    @Override public void onFinish(){
      if (stopped || !isEnabled() || getModel().getSelectedFeatures().isEmpty()|| getModel().getSelectedClasses().isEmpty()) {
        setStatusEmpty();
        return;
      }
      for (      final TableItem i : performanceTableOverview.getItems()) {
        i.dispose();
      }
      for (int i=0; i < targetVariables.length; i++) {
        TableItem item=new TableItem(performanceTableOverview,SWT.NONE);
        item.setText(0,targetVariables[i]);
        for (int j=0; j < values.get(i).size(); j++) {
          item.setData(String.valueOf(1 + j),values.get(i).get(j));
        }
      }
      String targetVariable=getModel().getSelectedAttribute();
      int targetIndex=getIndexOf(targetVariables,targetVariable);
      performanceTableOverview.setFocus();
      performanceTableOverview.select(targetIndex);
      updateOverview(performanceTableOverview.getItem(targetIndex).getText());
      performanceRoot.layout();
      performanceSash.setWeights(new int[]{2,2});
      rocCombo.setItems(targetVariables);
      rocCombo.select(targetIndex);
      rocRoot.layout();
      rocSash.setWeights(new int[]{2,2});
      setStatusDone();
      if (performanceTableOverview.getItemCount() != 0) {
        updateOverviewSelection(performanceTableOverview.getItem(targetIndex).getText());
      }
      String[] classValues=new String[performanceTableSensitivitySpecificity.getItems().length];
      for (int i=0; i < classValues.length; i++) {
        classValues[i]=performanceTableSensitivitySpecificity.getItem(i).getText(0);
      }
      int classIndex=getIndexOf(classValues,getModel().getSelectedClassValue());
      if (performanceTableSensitivitySpecificity.getItemCount() != 0) {
        updateROCSelection(performanceTableSensitivitySpecificity.getItem(classIndex).getText(0));
      }
    }
    @Override public void onInterrupt(){
      if (!isEnabled() || getModel().getSelectedFeatures().isEmpty() || getModel().getSelectedClasses().isEmpty()) {
        setStatusEmpty();
      }
 else {
        setStatusWorking();
      }
    }
    @Override public void run() throws InterruptedException {
      long time=System.currentTimeMillis();
      rocCurves.clear();
      originalRocCurves.clear();
      zerorRocCurves.clear();
      for (      String targetVariable : targetVariables) {
        StatisticsClassification result=builder.getClassificationPerformance(features,targetVariable,config,scaling);
        progress++;
        if (stopped) {
          break;
        }
        values.add(getColumnValuesForOverallPerformanceTable(result));
        if (!originalRocCurves.containsKey(targetVariable)) {
          originalRocCurves.put(targetVariable,new HashMap<String,ROCCurve>());
          zerorRocCurves.put(targetVariable,new HashMap<String,ROCCurve>());
          rocCurves.put(targetVariable,new HashMap<String,ROCCurve>());
        }
        for (        String c : result.getClassValues()) {
          originalRocCurves.get(targetVariable).put(c,result.getOriginalROCCurve(c));
          zerorRocCurves.get(targetVariable).put(c,result.getZeroRROCCurve(c));
          if (result.getROCCurve(c) != null) {
            rocCurves.get(targetVariable).put(c,result.getROCCurve(c));
          }
        }
      }
      while (System.currentTimeMillis() - time < MINIMAL_WORKING_TIME && !stopped) {
        Thread.sleep(10);
      }
    }
    @Override public void stop(){
      builder.interrupt();
      this.stopped=true;
    }
  }
;
  this.manager.start(analysis);
}