Program: 107733
Project: 107733
Buggy source:
/** 
 * Updates the view when a new target variable has been set Selects the first class value available for this target.
 * @param attribute
 */
private void updateSelectedTarget(String attribute){
  this.root.setRedraw(false);
  int index=0;
  boolean selected=false;
  for (  TableItem item : performanceTableOverview.getItems()) {
    if (item.getText(0).equals(attribute)) {
      performanceTableOverview.select(index);
      selected=true;
      break;
    }
    index++;
  }
  if (!selected) {
    this.root.setRedraw(true);
    return;
  }
  performanceTableSensitivitySpecificity.setRedraw(false);
  for (  final TableItem i : performanceTableSensitivitySpecificity.getItems()) {
    i.dispose();
  }
  performanceTableSensitivitySpecificity.setRedraw(true);
  if (originalRocCurves.containsKey(attribute)) {
    List<String> values=new ArrayList<>(originalRocCurves.get(attribute).keySet());
    Collections.sort(values);
    List<Double> sensitivities=new ArrayList<Double>();
    List<Double> specificities=new ArrayList<Double>();
    List<Double> brierscores=new ArrayList<Double>();
    for (    String clazz : values) {
      ROCCurve c;
      if (isOutput) {
        c=rocCurves.get(attribute).get(clazz);
      }
 else {
        c=originalRocCurves.get(attribute).get(clazz);
      }
      TableItem item=new TableItem(performanceTableSensitivitySpecificity,SWT.NONE);
      item.setText(0,clazz);
      item.setData("String_Node_Str",c.getSensitivity());
      item.setData("String_Node_Str",c.getSpecificity());
      item.setData("String_Node_Str",c.getBrierScore());
      sensitivities.add(c.getSensitivity());
      specificities.add(c.getSpecificity());
      brierscores.add(c.getBrierScore());
    }
    double[] min=new double[3];
    double[] avg=new double[3];
    double[] max=new double[3];
    for (int i=0; i < sensitivities.size(); i++) {
      double sensitivity=sensitivities.get(i);
      min[0]=min[0] == 0d ? sensitivity : Math.min(min[0],sensitivity);
      max[0]=Math.max(max[0],sensitivity);
      avg[0]+=sensitivity;
      double specificity=specificities.get(i);
      min[1]=min[1] == 0d ? specificity : Math.min(min[1],specificity);
      max[1]=Math.max(max[1],specificity);
      avg[1]+=specificity;
      double brierscore=brierscores.get(i);
      min[2]=min[2] == 0d ? brierscore : Math.min(min[2],brierscore);
      max[2]=Math.max(max[2],brierscore);
      avg[2]+=brierscore;
    }
    TableItem item=new TableItem(performanceTableSensitivitySpecificity,SWT.NONE);
    item.setText(0,Resources.getMessage("String_Node_Str"));
    item.setData("String_Node_Str",min[0]);
    item.setData("String_Node_Str",min[1]);
    item.setData("String_Node_Str",min[2]);
    item=new TableItem(performanceTableSensitivitySpecificity,SWT.NONE);
    item.setText(0,Resources.getMessage("String_Node_Str"));
    item.setData("String_Node_Str",avg[0] / values.size());
    item.setData("String_Node_Str",avg[1] / values.size());
    item.setData("String_Node_Str",avg[2] / values.size());
    item=new TableItem(performanceTableSensitivitySpecificity,SWT.NONE);
    item.setText(0,Resources.getMessage("String_Node_Str"));
    item.setData("String_Node_Str",max[0]);
    item.setData("String_Node_Str",max[1]);
    item.setData("String_Node_Str",max[2]);
    if (rocCombo.getItemCount() != 0) {
      String[] targetVariables=getModel().getSelectedClassesAsArray();
      String targetVariable=getModel().getSelectedAttribute();
      int targetIndex=getIndexOf(targetVariables,targetVariable);
      rocCombo.select(targetIndex);
      for (      final TableItem i : rocTable.getItems()) {
        i.dispose();
      }
      List<String> classes=new ArrayList<>(originalRocCurves.get(targetVariable).keySet());
      Collections.sort(classes);
      for (      String value : classes) {
        item=new TableItem(rocTable,SWT.NONE);
        item.setText(0,value);
        ROCCurve[] data={null,null,null};
        item.setData(data);
        ROCCurve rocZeror=zerorRocCurves.get(targetVariable).get(value);
        item.setData("String_Node_Str",rocZeror.getAUC());
        data[0]=rocZeror;
        ROCCurve rocOriginal=originalRocCurves.get(targetVariable).get(value);
        item.setData(isOutput ? "String_Node_Str" : "String_Node_Str",rocOriginal.getAUC());
        data[2]=rocOriginal;
        if (isOutput) {
          ROCCurve rocOutput=rocCurves.get(targetVariable).get(value);
          item.setData("String_Node_Str",rocOutput.getAUC());
          data[1]=rocOutput;
          double relativeAUC;
          if (rocOriginal.getAUC() - rocZeror.getAUC() == 0d) {
            relativeAUC=rocOutput.getAUC() / rocZeror.getAUC();
          }
 else {
            relativeAUC=(rocOutput.getAUC() - rocZeror.getAUC()) / (rocOriginal.getAUC() - rocZeror.getAUC());
          }
          item.setData("String_Node_Str",relativeAUC);
        }
      }
      if (classes.contains(getModel().getSelectedClassValue())) {
        updateSelectedClassValue(getModel().getSelectedClassValue());
      }
 else       if (!classes.isEmpty()) {
        updateSelectedClassValue(classes.get(0));
      }
    }
  }
  this.root.setRedraw(true);
}

Fixed version (ground truth):
/** 
 * Updates the view when a new target variable has been set. Selects the first class value available for this target.
 * @param targetAttribute
 */
private void updateSelectedTarget(String targetAttribute){
  if (performanceTableOverview.getItemCount() == 0) {
    return;
  }
  this.root.setRedraw(false);
  int index=0;
  boolean selected=false;
  for (  TableItem item : performanceTableOverview.getItems()) {
    if (item.getText(0).equals(targetAttribute)) {
      performanceTableOverview.select(index);
      selected=true;
      break;
    }
    index++;
  }
  if (!selected) {
    performanceTableOverview.select(0);
    targetAttribute=performanceTableOverview.getItem(0).getText(0);
  }
  performanceTableSensitivitySpecificity.setRedraw(false);
  for (  final TableItem i : performanceTableSensitivitySpecificity.getItems()) {
    i.dispose();
  }
  performanceTableSensitivitySpecificity.setRedraw(true);
  if (originalRocCurves.containsKey(targetAttribute)) {
    List<String> values=new ArrayList<>(originalRocCurves.get(targetAttribute).keySet());
    Collections.sort(values);
    List<Double> sensitivities=new ArrayList<Double>();
    List<Double> specificities=new ArrayList<Double>();
    List<Double> brierscores=new ArrayList<Double>();
    for (    String clazz : values) {
      ROCCurve c;
      if (isOutput) {
        c=rocCurves.get(targetAttribute).get(clazz);
      }
 else {
        c=originalRocCurves.get(targetAttribute).get(clazz);
      }
      TableItem item=new TableItem(performanceTableSensitivitySpecificity,SWT.NONE);
      item.setText(0,clazz);
      item.setData("String_Node_Str",c.getSensitivity());
      item.setData("String_Node_Str",c.getSpecificity());
      item.setData("String_Node_Str",c.getBrierScore());
      sensitivities.add(c.getSensitivity());
      specificities.add(c.getSpecificity());
      brierscores.add(c.getBrierScore());
    }
    double[] min=new double[3];
    double[] avg=new double[3];
    double[] max=new double[3];
    for (int i=0; i < sensitivities.size(); i++) {
      double sensitivity=sensitivities.get(i);
      min[0]=min[0] == 0d ? sensitivity : Math.min(min[0],sensitivity);
      max[0]=Math.max(max[0],sensitivity);
      avg[0]+=sensitivity;
      double specificity=specificities.get(i);
      min[1]=min[1] == 0d ? specificity : Math.min(min[1],specificity);
      max[1]=Math.max(max[1],specificity);
      avg[1]+=specificity;
      double brierscore=brierscores.get(i);
      min[2]=min[2] == 0d ? brierscore : Math.min(min[2],brierscore);
      max[2]=Math.max(max[2],brierscore);
      avg[2]+=brierscore;
    }
    TableItem item=new TableItem(performanceTableSensitivitySpecificity,SWT.NONE);
    item.setText(0,Resources.getMessage("String_Node_Str"));
    item.setData("String_Node_Str",min[0]);
    item.setData("String_Node_Str",min[1]);
    item.setData("String_Node_Str",min[2]);
    item=new TableItem(performanceTableSensitivitySpecificity,SWT.NONE);
    item.setText(0,Resources.getMessage("String_Node_Str"));
    item.setData("String_Node_Str",avg[0] / values.size());
    item.setData("String_Node_Str",avg[1] / values.size());
    item.setData("String_Node_Str",avg[2] / values.size());
    item=new TableItem(performanceTableSensitivitySpecificity,SWT.NONE);
    item.setText(0,Resources.getMessage("String_Node_Str"));
    item.setData("String_Node_Str",max[0]);
    item.setData("String_Node_Str",max[1]);
    item.setData("String_Node_Str",max[2]);
    if (rocCombo.getItemCount() != 0) {
      String[] targetVariables=getModel().getSelectedClassesAsArray();
      int targetIndex=getIndexOf(targetVariables,targetAttribute);
      rocCombo.select(targetIndex);
      for (      final TableItem i : rocTable.getItems()) {
        i.dispose();
      }
      List<String> classes=new ArrayList<>(originalRocCurves.get(targetAttribute).keySet());
      Collections.sort(classes);
      for (      String value : classes) {
        item=new TableItem(rocTable,SWT.NONE);
        item.setText(0,value);
        ROCCurve[] data={null,null,null};
        item.setData(data);
        ROCCurve rocZeror=zerorRocCurves.get(targetAttribute).get(value);
        item.setData("String_Node_Str",rocZeror.getAUC());
        data[0]=rocZeror;
        ROCCurve rocOriginal=originalRocCurves.get(targetAttribute).get(value);
        item.setData(isOutput ? "String_Node_Str" : "String_Node_Str",rocOriginal.getAUC());
        data[2]=rocOriginal;
        if (isOutput) {
          ROCCurve rocOutput=rocCurves.get(targetAttribute).get(value);
          item.setData("String_Node_Str",rocOutput.getAUC());
          data[1]=rocOutput;
          double relativeAUC;
          if (rocOriginal.getAUC() - rocZeror.getAUC() == 0d) {
            relativeAUC=rocOutput.getAUC() / rocZeror.getAUC();
          }
 else {
            relativeAUC=(rocOutput.getAUC() - rocZeror.getAUC()) / (rocOriginal.getAUC() - rocZeror.getAUC());
          }
          item.setData("String_Node_Str",relativeAUC);
        }
      }
      if (classes.contains(getModel().getSelectedClassValue())) {
        updateSelectedClassValue(getModel().getSelectedClassValue());
      }
 else       if (!classes.isEmpty()) {
        updateSelectedClassValue(classes.get(0));
      }
    }
  }
  this.root.setRedraw(true);
}