Program: 58671
Project: 58671
Buggy source:
/** 
 * Depending on the cluster state the corresponding clusterer will be called. Virtual arrays for content and storage will be returned.
 * @param clusterState All information needed ba cluster algorithm
 * @return array list of {@link IVirtualArray}s including VAs for content and storage.
 */
public ArrayList<IVirtualArray> cluster(ClusterState clusterState){
  ArrayList<IVirtualArray> iAlVAs=new ArrayList<IVirtualArray>();
  iAlVAs.add(set.getVA(clusterState.getContentVaId()));
  iAlVAs.add(set.getVA(clusterState.getStorageVaId()));
  IVirtualArray tempVA=null;
  AClusterer clusterer=null;
switch (clusterState.getClustererAlgo()) {
case TREE_CLUSTERER:
    clusterer=new TreeClusterer(0);
  try {
    if (clusterState.getClustererType() == EClustererType.GENE_CLUSTERING) {
      clusterer=new TreeClusterer(set.getVA(clusterState.getContentVaId()).size());
      tempVA=clusterer.getSortedVA(set,clusterState,0,2);
      if (tempVA != null)       iAlVAs.set(0,tempVA);
    }
 else     if (clusterState.getClustererType() == EClustererType.EXPERIMENTS_CLUSTERING) {
      clusterer=new TreeClusterer(set.getVA(clusterState.getStorageVaId()).size());
      tempVA=clusterer.getSortedVA(set,clusterState,0,2);
      if (tempVA != null)       iAlVAs.set(1,tempVA);
    }
 else     if (clusterState.getClustererType() == EClustererType.BI_CLUSTERING) {
      clusterer=new TreeClusterer(set.getVA(clusterState.getStorageVaId()).size());
      clusterState.setClustererType(EClustererType.EXPERIMENTS_CLUSTERING);
      tempVA=clusterer.getSortedVA(set,clusterState,0,1);
      if (tempVA != null) {
        iAlVAs.set(1,tempVA);
        clusterState.setClustererType(EClustererType.GENE_CLUSTERING);
        clusterer=new TreeClusterer(set.getVA(clusterState.getContentVaId()).size());
        tempVA=clusterer.getSortedVA(set,clusterState,50,1);
        if (tempVA != null)         iAlVAs.set(0,tempVA);
      }
    }
  }
 catch (  OutOfMemoryError e) {
  }
break;
case COBWEB_CLUSTERER:
clusterer=new HierarchicalClusterer(0);
if (clusterState.getClustererType() == EClustererType.GENE_CLUSTERING) {
tempVA=clusterer.getSortedVA(set,clusterState,0,2);
if (tempVA != null) iAlVAs.set(0,tempVA);
}
 else if (clusterState.getClustererType() == EClustererType.EXPERIMENTS_CLUSTERING) {
tempVA=clusterer.getSortedVA(set,clusterState,0,2);
if (tempVA != null) iAlVAs.set(1,tempVA);
}
 else if (clusterState.getClustererType() == EClustererType.BI_CLUSTERING) {
clusterState.setClustererType(EClustererType.EXPERIMENTS_CLUSTERING);
tempVA=clusterer.getSortedVA(set,clusterState,0,1);
if (tempVA != null) {
iAlVAs.set(1,tempVA);
clusterState.setClustererType(EClustererType.GENE_CLUSTERING);
tempVA=clusterer.getSortedVA(set,clusterState,50,1);
if (tempVA != null) iAlVAs.set(0,tempVA);
}
}
break;
case AFFINITY_PROPAGATION:
clusterer=new AffinityClusterer(0);
try {
if (clusterState.getClustererType() == EClustererType.GENE_CLUSTERING) {
clusterer=new AffinityClusterer(set.getVA(clusterState.getContentVaId()).size());
tempVA=clusterer.getSortedVA(set,clusterState,0,2);
if (tempVA != null) {
iAlVAs.set(0,tempVA);
setGroupList(tempVA,clusterState);
}
}
 else if (clusterState.getClustererType() == EClustererType.EXPERIMENTS_CLUSTERING) {
clusterer=new AffinityClusterer(set.getVA(clusterState.getStorageVaId()).size());
tempVA=clusterer.getSortedVA(set,clusterState,0,2);
if (tempVA != null) {
iAlVAs.set(1,tempVA);
setGroupList(tempVA,clusterState);
}
}
 else if (clusterState.getClustererType() == EClustererType.BI_CLUSTERING) {
clusterer=new AffinityClusterer(set.getVA(clusterState.getStorageVaId()).size());
clusterState.setClustererType(EClustererType.EXPERIMENTS_CLUSTERING);
tempVA=clusterer.getSortedVA(set,clusterState,0,1);
if (tempVA != null) {
iAlVAs.set(1,tempVA);
setGroupList(tempVA,clusterState);
clusterState.setClustererType(EClustererType.GENE_CLUSTERING);
clusterer=new AffinityClusterer(set.getVA(clusterState.getContentVaId()).size());
tempVA=clusterer.getSortedVA(set,clusterState,50,1);
if (tempVA != null) {
iAlVAs.set(0,tempVA);
setGroupList(tempVA,clusterState);
}
}
}
}
 catch (OutOfMemoryError e) {
clusterer.destroy();
}
break;
case KMEANS_CLUSTERER:
clusterer=new KMeansClusterer(0);
if (clusterState.getClustererType() == EClustererType.GENE_CLUSTERING) {
tempVA=clusterer.getSortedVA(set,clusterState,0,2);
if (tempVA != null) {
iAlVAs.set(0,tempVA);
setGroupList(tempVA,clusterState);
}
}
 else if (clusterState.getClustererType() == EClustererType.EXPERIMENTS_CLUSTERING) {
tempVA=clusterer.getSortedVA(set,clusterState,0,2);
if (tempVA != null) {
iAlVAs.set(1,tempVA);
setGroupList(tempVA,clusterState);
}
}
 else if (clusterState.getClustererType() == EClustererType.BI_CLUSTERING) {
clusterState.setClustererType(EClustererType.EXPERIMENTS_CLUSTERING);
tempVA=clusterer.getSortedVA(set,clusterState,0,1);
if (tempVA != null) {
iAlVAs.set(1,tempVA);
setGroupList(tempVA,clusterState);
clusterState.setClustererType(EClustererType.GENE_CLUSTERING);
tempVA=clusterer.getSortedVA(set,clusterState,50,1);
if (tempVA != null) {
iAlVAs.set(0,tempVA);
setGroupList(tempVA,clusterState);
}
}
}
break;
}
clusterer.destroy();
if (tempVA == null) {
GeneralManager.get().getGUIBridge().getDisplay().asyncExec(new Runnable(){
public void run(){
Shell shell=new Shell();
MessageBox messageBox=new MessageBox(shell,SWT.ERROR);
messageBox.setText("String_Node_Str");
messageBox.setMessage("String_Node_Str");
messageBox.open();
}
}
);
}
return iAlVAs;
}

Fixed version (ground truth):
/** 
 * Depending on the cluster state the corresponding clusterer will be called. Virtual arrays for content and storage will be returned.
 * @param clusterState All information needed ba cluster algorithm
 * @return array list of {@link IVirtualArray}s including VAs for content and storage.
 */
public ArrayList<IVirtualArray> cluster(ClusterState clusterState){
  ArrayList<IVirtualArray> iAlVAs=new ArrayList<IVirtualArray>();
  iAlVAs.add(set.getVA(clusterState.getContentVaId()));
  iAlVAs.add(set.getVA(clusterState.getStorageVaId()));
  IVirtualArray tempVA=null;
  AClusterer clusterer=null;
switch (clusterState.getClustererAlgo()) {
case TREE_CLUSTERER:
    clusterer=new TreeClusterer(0);
  try {
    if (clusterState.getClustererType() == EClustererType.GENE_CLUSTERING) {
      clusterer=new TreeClusterer(set.getVA(clusterState.getContentVaId()).size());
      tempVA=clusterer.getSortedVA(set,clusterState,0,2);
      if (tempVA != null)       iAlVAs.set(0,tempVA);
    }
 else     if (clusterState.getClustererType() == EClustererType.EXPERIMENTS_CLUSTERING) {
      clusterer=new TreeClusterer(set.getVA(clusterState.getStorageVaId()).size());
      tempVA=clusterer.getSortedVA(set,clusterState,0,2);
      if (tempVA != null)       iAlVAs.set(1,tempVA);
    }
 else     if (clusterState.getClustererType() == EClustererType.BI_CLUSTERING) {
      clusterer=new TreeClusterer(set.getVA(clusterState.getStorageVaId()).size());
      clusterState.setClustererType(EClustererType.EXPERIMENTS_CLUSTERING);
      tempVA=clusterer.getSortedVA(set,clusterState,0,1);
      if (tempVA != null) {
        iAlVAs.set(1,tempVA);
        clusterState.setClustererType(EClustererType.GENE_CLUSTERING);
        clusterer=new TreeClusterer(set.getVA(clusterState.getContentVaId()).size());
        tempVA=clusterer.getSortedVA(set,clusterState,50,1);
        if (tempVA != null)         iAlVAs.set(0,tempVA);
      }
    }
  }
 catch (  OutOfMemoryError e) {
  }
break;
case COBWEB_CLUSTERER:
clusterer=new HierarchicalClusterer(0);
if (clusterState.getClustererType() == EClustererType.GENE_CLUSTERING) {
tempVA=clusterer.getSortedVA(set,clusterState,0,2);
if (tempVA != null) iAlVAs.set(0,tempVA);
}
 else if (clusterState.getClustererType() == EClustererType.EXPERIMENTS_CLUSTERING) {
tempVA=clusterer.getSortedVA(set,clusterState,0,2);
if (tempVA != null) iAlVAs.set(1,tempVA);
}
 else if (clusterState.getClustererType() == EClustererType.BI_CLUSTERING) {
clusterState.setClustererType(EClustererType.EXPERIMENTS_CLUSTERING);
tempVA=clusterer.getSortedVA(set,clusterState,0,1);
if (tempVA != null) {
iAlVAs.set(1,tempVA);
clusterState.setClustererType(EClustererType.GENE_CLUSTERING);
tempVA=clusterer.getSortedVA(set,clusterState,50,1);
if (tempVA != null) iAlVAs.set(0,tempVA);
}
}
break;
case AFFINITY_PROPAGATION:
clusterer=new AffinityClusterer(0);
try {
if (clusterState.getClustererType() == EClustererType.GENE_CLUSTERING) {
clusterer=new AffinityClusterer(set.getVA(clusterState.getContentVaId()).size());
tempVA=clusterer.getSortedVA(set,clusterState,0,2);
if (tempVA != null) {
iAlVAs.set(0,tempVA);
setGroupList(tempVA,clusterState);
set.setClusteredTreeGenes(null);
}
}
 else if (clusterState.getClustererType() == EClustererType.EXPERIMENTS_CLUSTERING) {
clusterer=new AffinityClusterer(set.getVA(clusterState.getStorageVaId()).size());
tempVA=clusterer.getSortedVA(set,clusterState,0,2);
if (tempVA != null) {
iAlVAs.set(1,tempVA);
setGroupList(tempVA,clusterState);
set.setClusteredTreeExps(null);
}
}
 else if (clusterState.getClustererType() == EClustererType.BI_CLUSTERING) {
clusterer=new AffinityClusterer(set.getVA(clusterState.getStorageVaId()).size());
clusterState.setClustererType(EClustererType.EXPERIMENTS_CLUSTERING);
tempVA=clusterer.getSortedVA(set,clusterState,0,1);
if (tempVA != null) {
iAlVAs.set(1,tempVA);
setGroupList(tempVA,clusterState);
set.setClusteredTreeExps(null);
clusterState.setClustererType(EClustererType.GENE_CLUSTERING);
clusterer=new AffinityClusterer(set.getVA(clusterState.getContentVaId()).size());
tempVA=clusterer.getSortedVA(set,clusterState,50,1);
if (tempVA != null) {
iAlVAs.set(0,tempVA);
setGroupList(tempVA,clusterState);
set.setClusteredTreeGenes(null);
}
}
}
}
 catch (OutOfMemoryError e) {
clusterer.destroy();
}
break;
case KMEANS_CLUSTERER:
clusterer=new KMeansClusterer(0);
if (clusterState.getClustererType() == EClustererType.GENE_CLUSTERING) {
tempVA=clusterer.getSortedVA(set,clusterState,0,2);
if (tempVA != null) {
iAlVAs.set(0,tempVA);
setGroupList(tempVA,clusterState);
set.setClusteredTreeGenes(null);
}
}
 else if (clusterState.getClustererType() == EClustererType.EXPERIMENTS_CLUSTERING) {
tempVA=clusterer.getSortedVA(set,clusterState,0,2);
if (tempVA != null) {
iAlVAs.set(1,tempVA);
setGroupList(tempVA,clusterState);
set.setClusteredTreeExps(null);
}
}
 else if (clusterState.getClustererType() == EClustererType.BI_CLUSTERING) {
clusterState.setClustererType(EClustererType.EXPERIMENTS_CLUSTERING);
tempVA=clusterer.getSortedVA(set,clusterState,0,1);
if (tempVA != null) {
iAlVAs.set(1,tempVA);
setGroupList(tempVA,clusterState);
set.setClusteredTreeExps(null);
clusterState.setClustererType(EClustererType.GENE_CLUSTERING);
tempVA=clusterer.getSortedVA(set,clusterState,50,1);
if (tempVA != null) {
iAlVAs.set(0,tempVA);
setGroupList(tempVA,clusterState);
set.setClusteredTreeGenes(null);
}
}
}
break;
}
clusterer.destroy();
GeneralManager.get().getEventPublisher().triggerEvent(new UpdateViewEvent());
if (tempVA == null) {
GeneralManager.get().getGUIBridge().getDisplay().asyncExec(new Runnable(){
public void run(){
Shell shell=new Shell();
MessageBox messageBox=new MessageBox(shell,SWT.ERROR);
messageBox.setText("String_Node_Str");
messageBox.setMessage("String_Node_Str");
messageBox.open();
}
}
);
}
return iAlVAs;
}