Program: 58761
Project: 58761
Buggy source:
private Integer cluster(Integer iVAIdOriginal,Integer iVAIdStorage,EClustererType eClustererType){
  ArrayList<Integer> indexes=new ArrayList<Integer>();
  StringBuffer buffer=new StringBuffer();
  buffer.append("String_Node_Str");
  IVirtualArray contentVA=set.getVA(iVAIdOriginal);
  IVirtualArray storageVA=set.getVA(iVAIdStorage);
  int iPercentage=1;
  if (eClustererType == EClustererType.GENE_CLUSTERING) {
    GeneralManager.get().getEventPublisher().triggerEvent(new RenameProgressBarEvent("String_Node_Str"));
    for (int nr=0; nr < storageVA.size(); nr++) {
      buffer.append("String_Node_Str" + nr + "String_Node_Str");
    }
    buffer.append("String_Node_Str");
    int icnt=0;
    for (    Integer iContentIndex : contentVA) {
      if (bClusteringCanceled == false) {
        int tempPercentage=(int)((float)icnt / contentVA.size() * 100);
        if (iPercentage == tempPercentage) {
          GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(iPercentage,false));
          iPercentage++;
        }
        for (        Integer iStorageIndex : storageVA) {
          buffer.append(set.get(iStorageIndex).getFloat(EDataRepresentation.RAW,iContentIndex) + "String_Node_Str");
        }
        buffer.append("String_Node_Str");
        icnt++;
        processEvents();
      }
 else {
        GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
        return -2;
      }
    }
  }
 else {
    GeneralManager.get().getEventPublisher().triggerEvent(new RenameProgressBarEvent("String_Node_Str"));
    for (int nr=0; nr < contentVA.size(); nr++) {
      buffer.append("String_Node_Str" + nr + "String_Node_Str");
    }
    buffer.append("String_Node_Str");
    int isto=0;
    for (    Integer iStorageIndex : storageVA) {
      if (bClusteringCanceled == false) {
        int tempPercentage=(int)((float)isto / storageVA.size() * 100);
        if (iPercentage == tempPercentage) {
          GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(iPercentage,false));
          iPercentage++;
        }
        for (        Integer iContentIndex : contentVA) {
          buffer.append(set.get(iStorageIndex).getFloat(EDataRepresentation.RAW,iContentIndex) + "String_Node_Str");
        }
        buffer.append("String_Node_Str");
        isto++;
        processEvents();
      }
 else {
        GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
        return -2;
      }
    }
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(25 * iProgressBarMultiplier + iProgressBarOffsetValue,true));
  if (eClustererType == EClustererType.GENE_CLUSTERING)   GeneralManager.get().getEventPublisher().triggerEvent(new RenameProgressBarEvent("String_Node_Str"));
 else   GeneralManager.get().getEventPublisher().triggerEvent(new RenameProgressBarEvent("String_Node_Str"));
  Instances data=null;
  try {
    data=new Instances(new StringReader(buffer.toString()));
  }
 catch (  IOException e1) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return -1;
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(10,false));
  data.setClassIndex(-1);
  try {
    clusterer.buildClusterer(data);
  }
 catch (  Exception e) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return -1;
  }
  processEvents();
  if (bClusteringCanceled) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return -2;
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(45,false));
  ClusterEvaluation eval=new ClusterEvaluation();
  eval.setClusterer(clusterer);
  try {
    eval.evaluateClusterer(data);
  }
 catch (  Exception e) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return -1;
  }
  processEvents();
  if (bClusteringCanceled) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return -2;
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(60,false));
  double[] clusterAssignments=eval.getClusterAssignments();
  ArrayList<Integer> temp=new ArrayList<Integer>();
  ArrayList<Integer> alExamples=new ArrayList<Integer>();
  ArrayList<Double> clusters=new ArrayList<Double>();
  for (int i=0; i < clusterAssignments.length; i++) {
    if (clusters.contains(clusterAssignments[i]) == false)     clusters.add(clusterAssignments[i]);
  }
  HashMap<Double,Integer> hashClusters=new HashMap<Double,Integer>();
  for (int i=0; i < clusters.size(); i++) {
    hashClusters.put(clusters.get(i),i);
    temp.add(0);
    alExamples.add(0);
  }
  for (  double cluster : clusters) {
    for (int i=0; i < data.numInstances(); i++) {
      if (clusterAssignments[i] == cluster) {
        indexes.add(i);
        temp.set(hashClusters.get(cluster),temp.get(hashClusters.get(cluster)) + 1);
      }
    }
  }
  processEvents();
  if (bClusteringCanceled) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return -2;
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(80,false));
  Integer clusteredVAId=set.createStorageVA(indexes);
  CNode node=clusterer.m_cobwebTree;
  ClusterNode clusterNode=new ClusterNode("String_Node_Str",1,0f,0,true);
  tree.setRootNode(clusterNode);
  CNodeToTree(clusterNode,node,eClustererType);
  ClusterHelper.determineNrElements(tree);
  ClusterHelper.determineHierarchyDepth(tree);
  processEvents();
  if (bClusteringCanceled) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return -2;
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(90,false));
  if (eClustererType == EClustererType.GENE_CLUSTERING)   set.setClusteredTreeGenes(tree);
 else   set.setClusteredTreeExps(tree);
  set.setAlClusterSizes(temp);
  set.setAlExamples(alExamples);
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(50 * iProgressBarMultiplier + iProgressBarOffsetValue,true));
  return clusteredVAId;
}

Fixed version (ground truth):
private Integer cluster(Integer iVAIdOriginal,Integer iVAIdStorage,EClustererType eClustererType){
  ArrayList<Integer> indexes=new ArrayList<Integer>();
  StringBuffer buffer=new StringBuffer();
  buffer.append("String_Node_Str");
  IVirtualArray contentVA=set.getVA(iVAIdOriginal);
  IVirtualArray storageVA=set.getVA(iVAIdStorage);
  int iPercentage=1;
  if (eClustererType == EClustererType.GENE_CLUSTERING) {
    GeneralManager.get().getEventPublisher().triggerEvent(new RenameProgressBarEvent("String_Node_Str"));
    for (int nr=0; nr < storageVA.size(); nr++) {
      buffer.append("String_Node_Str" + nr + "String_Node_Str");
    }
    buffer.append("String_Node_Str");
    int icnt=0;
    for (    Integer iContentIndex : contentVA) {
      if (bClusteringCanceled == false) {
        int tempPercentage=(int)((float)icnt / contentVA.size() * 100);
        if (iPercentage == tempPercentage) {
          GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(iPercentage,false));
          iPercentage++;
        }
        for (        Integer iStorageIndex : storageVA) {
          buffer.append(set.get(iStorageIndex).getFloat(EDataRepresentation.RAW,iContentIndex) + "String_Node_Str");
        }
        buffer.append("String_Node_Str");
        icnt++;
        processEvents();
      }
 else {
        GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
        return -2;
      }
    }
  }
 else {
    GeneralManager.get().getEventPublisher().triggerEvent(new RenameProgressBarEvent("String_Node_Str"));
    for (int nr=0; nr < contentVA.size(); nr++) {
      buffer.append("String_Node_Str" + nr + "String_Node_Str");
    }
    buffer.append("String_Node_Str");
    int isto=0;
    for (    Integer iStorageIndex : storageVA) {
      if (bClusteringCanceled == false) {
        int tempPercentage=(int)((float)isto / storageVA.size() * 100);
        if (iPercentage == tempPercentage) {
          GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(iPercentage,false));
          iPercentage++;
        }
        for (        Integer iContentIndex : contentVA) {
          buffer.append(set.get(iStorageIndex).getFloat(EDataRepresentation.RAW,iContentIndex) + "String_Node_Str");
        }
        buffer.append("String_Node_Str");
        isto++;
        processEvents();
      }
 else {
        GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
        return -2;
      }
    }
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(25 * iProgressBarMultiplier + iProgressBarOffsetValue,true));
  if (eClustererType == EClustererType.GENE_CLUSTERING)   GeneralManager.get().getEventPublisher().triggerEvent(new RenameProgressBarEvent("String_Node_Str"));
 else   GeneralManager.get().getEventPublisher().triggerEvent(new RenameProgressBarEvent("String_Node_Str"));
  Instances data=null;
  try {
    data=new Instances(new StringReader(buffer.toString()));
  }
 catch (  IOException e1) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return -1;
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(10,false));
  data.setClassIndex(-1);
  try {
    clusterer.buildClusterer(data);
  }
 catch (  Exception e) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return -1;
  }
  processEvents();
  if (bClusteringCanceled) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return -2;
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(45,false));
  ClusterEvaluation eval=new ClusterEvaluation();
  eval.setClusterer(clusterer);
  try {
    eval.evaluateClusterer(data);
  }
 catch (  Exception e) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return -1;
  }
  processEvents();
  if (bClusteringCanceled) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return -2;
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(60,false));
  double[] clusterAssignments=eval.getClusterAssignments();
  ArrayList<Integer> temp=new ArrayList<Integer>();
  ArrayList<Integer> alExamples=new ArrayList<Integer>();
  ArrayList<Double> clusters=new ArrayList<Double>();
  for (int i=0; i < clusterAssignments.length; i++) {
    if (clusters.contains(clusterAssignments[i]) == false)     clusters.add(clusterAssignments[i]);
  }
  HashMap<Double,Integer> hashClusters=new HashMap<Double,Integer>();
  for (int i=0; i < clusters.size(); i++) {
    hashClusters.put(clusters.get(i),i);
    temp.add(0);
    alExamples.add(0);
  }
  for (  double cluster : clusters) {
    for (int i=0; i < data.numInstances(); i++) {
      if (clusterAssignments[i] == cluster) {
        indexes.add(i);
        temp.set(hashClusters.get(cluster),temp.get(hashClusters.get(cluster)) + 1);
      }
    }
  }
  processEvents();
  if (bClusteringCanceled) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return -2;
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(80,false));
  Integer clusteredVAId=0;
  if (eClustererType == EClustererType.GENE_CLUSTERING)   clusteredVAId=set.createStorageVA(indexes);
 else   if (eClustererType == EClustererType.EXPERIMENTS_CLUSTERING)   clusteredVAId=set.createSetVA(indexes);
  CNode node=clusterer.m_cobwebTree;
  ClusterNode clusterNode=new ClusterNode("String_Node_Str",1,0f,0,true);
  tree.setRootNode(clusterNode);
  CNodeToTree(clusterNode,node,eClustererType);
  ClusterHelper.determineNrElements(tree);
  ClusterHelper.determineHierarchyDepth(tree);
  processEvents();
  if (bClusteringCanceled) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return -2;
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(90,false));
  if (eClustererType == EClustererType.GENE_CLUSTERING)   set.setClusteredTreeGenes(tree);
 else   set.setClusteredTreeExps(tree);
  set.setAlClusterSizes(temp);
  set.setAlExamples(alExamples);
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(50 * iProgressBarMultiplier + iProgressBarOffsetValue,true));
  return clusteredVAId;
}