Program: 58652
Project: 58652
Buggy source:
private IVirtualArray cluster(ISet set,ClusterState clusterState){
  ArrayList<Integer> indices=new ArrayList<Integer>();
  StringBuffer buffer=new StringBuffer();
  buffer.append("String_Node_Str");
  IVirtualArray contentVA=set.getVA(iVAIdContent);
  IVirtualArray storageVA=set.getVA(iVAIdStorage);
  int iPercentage=1;
  if (clusterState.getClustererType() == 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 null;
      }
    }
  }
 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 null;
      }
    }
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(25 * iProgressBarMultiplier + iProgressBarOffsetValue,true));
  if (clusterState.getClustererType() == 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 null;
  }
  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 null;
  }
  processEvents();
  if (bClusteringCanceled) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return null;
  }
  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 null;
  }
  processEvents();
  if (bClusteringCanceled) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return null;
  }
  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) {
        indices.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 null;
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(80,false));
  IVirtualArray virtualArray=null;
  if (clusterState.getClustererType() == EClustererType.GENE_CLUSTERING)   virtualArray=new VirtualArray(EVAType.CONTENT,set.depth(),indices);
 else   if (clusterState.getClustererType() == EClustererType.EXPERIMENTS_CLUSTERING)   virtualArray=new VirtualArray(EVAType.STORAGE,set.size(),indices);
  CNode node=clusterer.m_cobwebTree;
  ClusterNode clusterNode=new ClusterNode("String_Node_Str",0,0f,0,true);
  tree.setRootNode(clusterNode);
  CNodeToTree(clusterNode,node,clusterState.getClustererType());
  ClusterHelper.determineNrElements(tree);
  ClusterHelper.determineHierarchyDepth(tree);
  processEvents();
  if (bClusteringCanceled) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return null;
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(90,false));
  if (clusterState.getClustererType() == EClustererType.GENE_CLUSTERING)   set.setClusteredTreeGenes(tree);
 else   set.setClusteredTreeExps(tree);
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(50 * iProgressBarMultiplier + iProgressBarOffsetValue,true));
  return virtualArray;
}

Fixed version (ground truth):
private IVirtualArray cluster(ISet set,ClusterState clusterState){
  ArrayList<Integer> indices=new ArrayList<Integer>();
  StringBuffer buffer=new StringBuffer();
  buffer.append("String_Node_Str");
  IVirtualArray contentVA=set.getVA(iVAIdContent);
  IVirtualArray storageVA=set.getVA(iVAIdStorage);
  int iPercentage=1;
  if (clusterState.getClustererType() == 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 null;
      }
    }
  }
 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 null;
      }
    }
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(25 * iProgressBarMultiplier + iProgressBarOffsetValue,true));
  if (clusterState.getClustererType() == 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 null;
  }
  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 null;
  }
  processEvents();
  if (bClusteringCanceled) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return null;
  }
  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 null;
  }
  processEvents();
  if (bClusteringCanceled) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return null;
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(60,false));
  double[] clusterAssignments=eval.getClusterAssignments();
  ArrayList<Double> clusters=new ArrayList<Double>();
  for (int i=0; i < clusterAssignments.length; i++) {
    if (clusters.contains(clusterAssignments[i]) == false)     clusters.add(clusterAssignments[i]);
  }
  Arrays.sort(clusterAssignments);
  for (int i=0; i < data.numInstances(); i++) {
    int temp=0;
    for (    double cluster : clusters) {
      if (clusterAssignments[i] == cluster) {
        indices.add(temp);
        break;
      }
      temp++;
    }
  }
  processEvents();
  if (bClusteringCanceled) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return null;
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(80,false));
  IVirtualArray virtualArray=null;
  if (clusterState.getClustererType() == EClustererType.GENE_CLUSTERING)   virtualArray=new VirtualArray(EVAType.CONTENT,set.depth(),indices);
 else   if (clusterState.getClustererType() == EClustererType.EXPERIMENTS_CLUSTERING)   virtualArray=new VirtualArray(EVAType.STORAGE,set.size(),indices);
  CNode node=clusterer.m_cobwebTree;
  ClusterNode clusterNode=new ClusterNode("String_Node_Str",0,0f,0,true);
  tree.setRootNode(clusterNode);
  CNodeToTree(clusterNode,node,clusterState.getClustererType());
  ClusterHelper.determineNrElements(tree);
  ClusterHelper.determineHierarchyDepth(tree);
  processEvents();
  if (bClusteringCanceled) {
    GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(100,true));
    return null;
  }
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(90,false));
  if (clusterState.getClustererType() == EClustererType.GENE_CLUSTERING)   set.setClusteredTreeGenes(tree);
 else   set.setClusteredTreeExps(tree);
  GeneralManager.get().getEventPublisher().triggerEvent(new ClusterProgressEvent(50 * iProgressBarMultiplier + iProgressBarOffsetValue,true));
  return virtualArray;
}