Program: 58756
Project: 58756
Buggy source:
public Integer cluster(ISet set,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) {
    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,true));
          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       return -1;
    }
  }
 else {
    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,true));
          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       return -1;
    }
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
  Instances data=null;
  try {
    data=new Instances(new StringReader(buffer.toString()));
  }
 catch (  IOException e1) {
    return -1;
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(10,false));
  data.setClassIndex(-1);
  try {
    clusterer.buildClusterer(data);
  }
 catch (  Exception e) {
    return -1;
  }
  processEvents();
  if (bClusteringCanceled)   return -1;
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(45,false));
  ClusterEvaluation eval=new ClusterEvaluation();
  eval.setClusterer(clusterer);
  try {
    eval.evaluateClusterer(data);
  }
 catch (  Exception e) {
    return -1;
  }
  processEvents();
  if (bClusteringCanceled)   return -1;
  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)   return -1;
  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);
  ClusterHelper.determineNrElements(tree);
  ClusterHelper.determineHierarchyDepth(tree);
  processEvents();
  if (bClusteringCanceled)   return -1;
  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(100,false));
  return clusteredVAId;
}

Fixed version (ground truth):
public 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) {
    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,true));
          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       return -1;
    }
  }
 else {
    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,true));
          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       return -1;
    }
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
  Instances data=null;
  try {
    data=new Instances(new StringReader(buffer.toString()));
  }
 catch (  IOException e1) {
    return -1;
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(10,false));
  data.setClassIndex(-1);
  try {
    clusterer.buildClusterer(data);
  }
 catch (  Exception e) {
    return -1;
  }
  processEvents();
  if (bClusteringCanceled)   return -1;
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(45,false));
  ClusterEvaluation eval=new ClusterEvaluation();
  eval.setClusterer(clusterer);
  try {
    eval.evaluateClusterer(data);
  }
 catch (  Exception e) {
    return -1;
  }
  processEvents();
  if (bClusteringCanceled)   return -1;
  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)   return -1;
  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)   return -1;
  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(100,false));
  return clusteredVAId;
}