nus-yam/ex-repair huggingface dataset:
Program: 58138
Project: 58138
Buggy source:
public void saveSelection(){
  contentSelectionManager.removeElements(SelectionType.DESELECTED);
  clearAllSelections();
  setDisplayListDirty();
  contentVA.setGroupList(null);
  ReplaceContentVAInUseCaseEvent event=new ReplaceContentVAInUseCaseEvent(dataDomain.getDataDomainType(),contentVAType,contentVA);
  event.setDataDomainType(dataDomain.getDataDomainType());
  event.setSender(this);
  eventPublisher.triggerEvent(event);
}

Fixed version (ground truth):
public void saveSelection(){
  Set<Integer> removedElements=contentSelectionManager.getElements(SelectionType.DESELECTED);
  ContentVADelta delta=new ContentVADelta(ContentVAType.CONTENT,contentIDType);
  for (  Integer contentID : removedElements) {
    delta.add(VADeltaItem.removeElement(contentID));
  }
  contentSelectionManager.clearSelection(SelectionType.DESELECTED);
  clearFilters();
  triggerContentFilterEvent(delta,"String_Node_Str");
}
Program: 58140
Project: 58140
Buggy source:
/** 
 * Reset all selections and deselections
 */
@Override public void clearAllSelections(){
  initGates();
  contentSelectionManager.clearSelections();
  storageSelectionManager.clearSelections();
  bIsAngularBrushingActive=false;
  for (  ArrayList<Integer> alCurrent : alIsAngleBlocking) {
    alCurrent.clear();
  }
  for (  ArrayList<Integer> alCurrent : hashIsGateBlocking.values()) {
    alCurrent.clear();
  }
  setDisplayListDirty();
  connectedElementRepresentationManager.clear(contentIDType);
}

Fixed version (ground truth):
/** 
 * Reset all selections and deselections
 */
@Override public void clearAllSelections(){
  contentSelectionManager.clearSelections();
  storageSelectionManager.clearSelections();
  clearFilters();
  setDisplayListDirty();
  connectedElementRepresentationManager.clear(contentIDType);
}
Program: 58141
Project: 58141
Buggy source:
/** 
 * Sets a storageVA. The storageVA in the storageData object is replaced and the other elements in the storageData are reset.
 * @param vaType
 * @param virtualArray
 */
public void setStorageVA(StorageVAType vaType,StorageVirtualArray virtualArray);

Fixed version (ground truth):
/** 
 * Sets a storageVA. The storageVA in the storageData object is replaced and the other elements in the storageData are reset.
 * @param vaType
 * @param virtualArray
 */
public void setStorageVA(String vaType,StorageVirtualArray virtualArray);
Program: 58142
Project: 58142
Buggy source:
/** 
 * Returns a   {@link ContentData} object for the specified ContentVAType. The ContentData provides accessto all data on a storage, e.g., virtualArryay, cluster tree, group list etc.
 * @param vaType
 * @return
 */
public ContentData getContentData(ContentVAType vaType);

Fixed version (ground truth):
/** 
 * Returns a   {@link ContentData} object for the specified ContentVAType. The ContentData provides accessto all data on a storage, e.g., virtualArryay, cluster tree, group list etc.
 * @param vaType
 * @return
 */
public ContentData getContentData(String vaType);
Program: 58143
Project: 58143
Buggy source:
/** 
 * Iterate over the storages based on a virtual array
 * @param type
 * @return
 */
public Iterator<IStorage> iterator(StorageVAType type);

Fixed version (ground truth):
/** 
 * Iterate over the storages based on a virtual array
 * @param type
 * @return
 */
public Iterator<IStorage> iterator(String type);
Program: 58144
Project: 58144
Buggy source:
/** 
 * Returns a   {@link StorageData} object for the specified StorageVAType. The StorageData provides accessto all data on a storage, e.g., virtualArryay, cluster tree, group list etc.
 * @param vaType
 * @return
 */
public StorageData getStorageData(StorageVAType vaType);

Fixed version (ground truth):
/** 
 * Returns a   {@link StorageData} object for the specified StorageVAType. The StorageData provides accessto all data on a storage, e.g., virtualArryay, cluster tree, group list etc.
 * @param vaType
 * @return
 */
public StorageData getStorageData(String vaType);
Program: 58145
Project: 58145
Buggy source:
/** 
 * Set a contentVA. The contentVA in the contentData object is replaced and the other elements in the contentData are reset.
 * @param vaType
 * @param virtualArray
 */
public void setContentVA(ContentVAType vaType,ContentVirtualArray virtualArray);

Fixed version (ground truth):
/** 
 * Set a contentVA. The contentVA in the contentData object is replaced and the other elements in the contentData are reset.
 * @param vaType
 * @param virtualArray
 */
public void setContentVA(String vaType,ContentVirtualArray virtualArray);
Program: 58146
Project: 58146
Buggy source:
public void exportTrees(ISet set,String directory){
  try {
    Tree<ClusterNode> tree=set.getContentData(ContentVAType.CONTENT).getContentTree();
    if (tree != null) {
      TreePorter treePorter=new TreePorter();
      treePorter.setDataDomain(set.getDataDomain());
      treePorter.exportTree(directory + "String_Node_Str",tree);
    }
    tree=set.getStorageData(StorageVAType.STORAGE).getStorageTree();
    if (tree != null) {
      TreePorter treePorter=new TreePorter();
      treePorter.setDataDomain(set.getDataDomain());
      treePorter.exportTree(directory + "String_Node_Str",tree);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void exportTrees(ISet set,String directory){
  try {
    Tree<ClusterNode> tree=set.getContentData(Set.CONTENT).getContentTree();
    if (tree != null) {
      TreePorter treePorter=new TreePorter();
      treePorter.setDataDomain(set.getDataDomain());
      treePorter.exportTree(directory + "String_Node_Str",tree);
    }
    tree=set.getStorageData(Set.STORAGE).getStorageTree();
    if (tree != null) {
      TreePorter treePorter=new TreePorter();
      treePorter.setDataDomain(set.getDataDomain());
      treePorter.exportTree(directory + "String_Node_Str",tree);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 58147
Project: 58147
Buggy source:
public void exportGroups(ISet set,String sFileName,ArrayList<Integer> alGenes,ArrayList<Integer> alExperiments,IDType targetIDType){
  try {
    PrintWriter out=new PrintWriter(new BufferedWriter(new FileWriter(sFileName)));
    out.print("String_Node_Str");
    for (    Integer iStorageIndex : alExperiments) {
      out.print(set.get(iStorageIndex).getLabel());
      out.print("String_Node_Str");
    }
    out.println();
    String identifier;
    IDMappingManager iDMappingManager=GeneralManager.get().getIDMappingManager();
    for (    Integer iContentIndex : alGenes) {
      if (set.getDataDomain().getDataDomainType().equals("String_Node_Str")) {
        Set<String> setRefSeqIDs=iDMappingManager.getIDAsSet(set.getDataDomain().getContentIDType(),targetIDType,iContentIndex);
        if ((setRefSeqIDs != null && !setRefSeqIDs.isEmpty())) {
          identifier=(String)setRefSeqIDs.toArray()[0];
        }
 else {
          continue;
        }
      }
 else {
        identifier=iDMappingManager.getID(set.getDataDomain().getContentIDType(),targetIDType,iContentIndex);
      }
      out.print(identifier + "String_Node_Str");
      for (      Integer iStorageIndex : alExperiments) {
        IStorage storage=set.get(iStorageIndex);
        out.print(storage.getFloat(EDataRepresentation.RAW,iContentIndex));
        out.print("String_Node_Str");
      }
      out.println();
    }
    out.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void exportGroups(ISet set,String sFileName,ArrayList<Integer> alGenes,ArrayList<Integer> alExperiments,IDType targetIDType){
  try {
    PrintWriter out=new PrintWriter(new BufferedWriter(new FileWriter(sFileName)));
    out.print("String_Node_Str");
    for (    Integer iStorageIndex : alExperiments) {
      out.print(set.get(iStorageIndex).getLabel());
      out.print("String_Node_Str");
    }
    out.println();
    String identifier;
    IDMappingManager iDMappingManager=GeneralManager.get().getIDMappingManager();
    for (    Integer iContentIndex : alGenes) {
      if (set.getDataDomain().getDataDomainType().equals("String_Node_Str")) {
        java.util.Set<String> setRefSeqIDs=iDMappingManager.getIDAsSet(set.getDataDomain().getContentIDType(),targetIDType,iContentIndex);
        if ((setRefSeqIDs != null && !setRefSeqIDs.isEmpty())) {
          identifier=(String)setRefSeqIDs.toArray()[0];
        }
 else {
          continue;
        }
      }
 else {
        identifier=iDMappingManager.getID(set.getDataDomain().getContentIDType(),targetIDType,iContentIndex);
      }
      out.print(identifier + "String_Node_Str");
      for (      Integer iStorageIndex : alExperiments) {
        IStorage storage=set.get(iStorageIndex);
        out.print(storage.getFloat(EDataRepresentation.RAW,iContentIndex));
        out.print("String_Node_Str");
      }
      out.println();
    }
    out.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 58149
Project: 58149
Buggy source:
@SuppressWarnings("String_Node_Str") public MetaSet(Set originalSet,Tree<ClusterNode> storageTree,ClusterNode storageTreeRoot){
  super();
  this.dataDomain=originalSet.getDataDomain();
  this.iUniqueID=GeneralManager.get().getIDManager().createID(EManagedObjectType.SET);
  this.isSetHomogeneous=true;
  this.externalDataRep=originalSet.getExternalDataRep();
  this.hashContentData=(HashMap<ContentVAType,ContentData>)originalSet.hashContentData.clone();
  this.hashStorages=new HashMap<Integer,IStorage>();
  defaultStorageData=new StorageData();
  defaultStorageData.setStorageVA(new StorageVirtualArray(StorageVAType.STORAGE));
  defaultStorageData.setStorageTree(storageTree);
  defaultStorageData.setStorageTreeRoot(storageTreeRoot);
  hashStorageData=new HashMap<StorageVAType,StorageData>();
  hashStorageData.put(StorageVAType.STORAGE,defaultStorageData.clone());
  defaultStorageData.setStorageVA(new StorageVirtualArray(StorageVAType.STORAGE));
  statisticsResult=new StatisticsResult(this);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public MetaSet(Set originalSet,Tree<ClusterNode> storageTree,ClusterNode storageTreeRoot){
  super();
  this.dataDomain=originalSet.getDataDomain();
  this.iUniqueID=GeneralManager.get().getIDManager().createID(EManagedObjectType.SET);
  this.isSetHomogeneous=true;
  this.externalDataRep=originalSet.getExternalDataRep();
  this.hashContentData=(HashMap<String,ContentData>)originalSet.hashContentData.clone();
  this.hashStorages=new HashMap<Integer,IStorage>();
  defaultStorageData=new StorageData();
  defaultStorageData.setStorageVA(new StorageVirtualArray(STORAGE));
  defaultStorageData.setStorageTree(storageTree);
  defaultStorageData.setStorageTreeRoot(storageTreeRoot);
  hashStorageData=new HashMap<String,StorageData>();
  hashStorageData.put(STORAGE,defaultStorageData.clone());
  defaultStorageData.setStorageVA(new StorageVirtualArray(STORAGE));
  statisticsResult=new StatisticsResult(this);
}
Program: 58150
Project: 58150
Buggy source:
@Override public void cluster(ClusterState clusterState){
  if (bIsNumerical == true && isSetHomogeneous == true) {
    ContentVAType contentVAType=clusterState.getContentVAType();
    if (contentVAType != null) {
      clusterState.setContentVA(getContentData(contentVAType).getContentVA());
      clusterState.setContentIDType(dataDomain.getContentIDType());
    }
    StorageVAType storageVAType=clusterState.getStorageVAType();
    if (storageVAType != null) {
      clusterState.setStorageVA(getStorageData(storageVAType).getStorageVA());
      clusterState.setStorageIDType(dataDomain.getStorageIDType());
    }
    ClusterManager clusterManager=new ClusterManager(this);
    ClusterResult result=clusterManager.cluster(clusterState);
    ContentData contentResult=result.getContentResult();
    if (contentResult != null) {
      hashContentData.put(clusterState.getContentVAType(),contentResult);
    }
    StorageData storageResult=result.getStorageResult();
    if (storageResult != null) {
      hashStorageData.put(clusterState.getStorageVAType(),storageResult);
    }
  }
 else   throw new IllegalStateException("String_Node_Str");
}

Fixed version (ground truth):
@Override public void cluster(ClusterState clusterState){
  if (bIsNumerical == true && isSetHomogeneous == true) {
    String contentVAType=clusterState.getContentVAType();
    if (contentVAType != null) {
      clusterState.setContentVA(getContentData(contentVAType).getContentVA());
      clusterState.setContentIDType(dataDomain.getContentIDType());
    }
    String storageVAType=clusterState.getStorageVAType();
    if (storageVAType != null) {
      clusterState.setStorageVA(getStorageData(storageVAType).getStorageVA());
      clusterState.setStorageIDType(dataDomain.getStorageIDType());
    }
    ClusterManager clusterManager=new ClusterManager(this);
    ClusterResult result=clusterManager.cluster(clusterState);
    ContentData contentResult=result.getContentResult();
    if (contentResult != null) {
      hashContentData.put(clusterState.getContentVAType(),contentResult);
    }
    StorageData storageResult=result.getStorageResult();
    if (storageResult != null) {
      hashStorageData.put(clusterState.getStorageVAType(),storageResult);
    }
  }
 else   throw new IllegalStateException("String_Node_Str");
}
Program: 58151
Project: 58151
Buggy source:
private ContentData createContentData(ContentVAType vaType){
  ContentData contentData=new ContentData(dataDomain.getContentIDType());
  ContentVirtualArray contentVA=new ContentVirtualArray(vaType);
  if (!vaType.isEmptyByDefault()) {
    for (int count=0; count < depth(); count++) {
      contentVA.append(count);
    }
  }
  contentData.setContentVA(contentVA);
  return contentData;
}

Fixed version (ground truth):
private ContentData createContentData(String vaType){
  ContentData contentData=new ContentData(dataDomain.getContentIDType());
  ContentVirtualArray contentVA=new ContentVirtualArray(vaType);
  if (vaType != CONTENT_CONTEXT) {
    for (int count=0; count < depth(); count++) {
      contentVA.append(count);
    }
  }
  contentData.setContentVA(contentVA);
  return contentData;
}
Program: 58152
Project: 58152
Buggy source:
@Override public void setStorageVA(StorageVAType vaType,StorageVirtualArray virtualArray){
  StorageData storageData=hashStorageData.get(vaType);
  if (storageData == null)   storageData=defaultStorageData.clone();
 else   storageData.reset();
  storageData.setStorageVA(virtualArray);
  hashStorageData.put(vaType,storageData);
}

Fixed version (ground truth):
@Override public void setStorageVA(String vaType,StorageVirtualArray virtualArray){
  StorageData storageData=hashStorageData.get(vaType);
  if (storageData == null)   storageData=defaultStorageData.clone();
 else   storageData.reset();
  storageData.setStorageVA(virtualArray);
  hashStorageData.put(vaType,storageData);
}
Program: 58153
Project: 58153
Buggy source:
@Override public ContentData getContentData(ContentVAType vaType){
  ContentData contentData=hashContentData.get(vaType);
  if (contentData == null) {
    contentData=createContentData(vaType);
    hashContentData.put(vaType,contentData);
  }
  return contentData;
}

Fixed version (ground truth):
@Override public ContentData getContentData(String vaType){
  ContentData contentData=hashContentData.get(vaType);
  if (contentData == null) {
    contentData=createContentData(vaType);
    hashContentData.put(vaType,contentData);
  }
  return contentData;
}
Program: 58154
Project: 58154
Buggy source:
@Override public Iterator<IStorage> iterator(StorageVAType type){
  return new StorageIterator(hashStorages,hashStorageData.get(type).getStorageVA());
}

Fixed version (ground truth):
@Override public Iterator<IStorage> iterator(String type){
  return new StorageIterator(hashStorages,hashStorageData.get(type).getStorageVA());
}
Program: 58155
Project: 58155
Buggy source:
@Override public void restoreOriginalContentVA(){
  ContentData contentData=createContentData(ContentVAType.CONTENT);
  hashContentData.put(ContentVAType.CONTENT,contentData);
}

Fixed version (ground truth):
@Override public void restoreOriginalContentVA(){
  ContentData contentData=createContentData(CONTENT);
  hashContentData.put(CONTENT,contentData);
}
Program: 58156
Project: 58156
Buggy source:
@Override public void setContentVA(ContentVAType vaType,ContentVirtualArray virtualArray){
  ContentData contentData=hashContentData.get(vaType);
  if (contentData == null)   contentData=createContentData(vaType);
 else   contentData.reset();
  contentData.setContentVA(virtualArray);
  hashContentData.put(vaType,contentData);
}

Fixed version (ground truth):
@Override public void setContentVA(String vaType,ContentVirtualArray virtualArray){
  ContentData contentData=hashContentData.get(vaType);
  if (contentData == null)   contentData=createContentData(vaType);
 else   contentData.reset();
  contentData.setContentVA(virtualArray);
  hashContentData.put(vaType,contentData);
}
Program: 58157
Project: 58157
Buggy source:
/** 
 * Initialization of member variables. Safe to be called by sub-classes.
 */
protected void init(){
  hashStorages=new HashMap<Integer,IStorage>();
  hashContentData=new HashMap<ContentVAType,ContentData>();
  hashStorageData=new HashMap<StorageVAType,StorageData>(3);
  defaultStorageData=new StorageData();
  defaultStorageData.setStorageVA(new StorageVirtualArray(StorageVAType.STORAGE));
  statisticsResult=new StatisticsResult(this);
}

Fixed version (ground truth):
/** 
 * Initialization of member variables. Safe to be called by sub-classes.
 */
protected void init(){
  hashStorages=new HashMap<Integer,IStorage>();
  hashContentData=new HashMap<String,ContentData>(6);
  hashStorageData=new HashMap<String,StorageData>(3);
  defaultStorageData=new StorageData();
  defaultStorageData.setStorageVA(new StorageVirtualArray(STORAGE));
  statisticsResult=new StatisticsResult(this);
}
Program: 58158
Project: 58158
Buggy source:
/** 
 * Creates a   {@link MetaSet} for every node in the storage tree.
 */
public void createMetaSets(){
  ClusterNode rootNode=hashStorageData.get(StorageVAType.STORAGE).getStorageTreeRoot();
  rootNode.createMetaSets(this);
}

Fixed version (ground truth):
/** 
 * Creates a   {@link MetaSet} for every node in the storage tree.
 */
public void createMetaSets(){
  ClusterNode rootNode=hashStorageData.get(STORAGE).getStorageTreeRoot();
  rootNode.createMetaSets(this);
}
Program: 58159
Project: 58159
Buggy source:
@Override public StorageData getStorageData(StorageVAType vaType){
  return hashStorageData.get(vaType);
}

Fixed version (ground truth):
@Override public StorageData getStorageData(String vaType){
  return hashStorageData.get(vaType);
}
Program: 58160
Project: 58160
Buggy source:
void finalizeAddedStorages(){
  if ((this.getClass().equals(Set.class))) {
    Tree<ClusterNode> tree=defaultStorageData.getStorageTree();
    int count=1;
    for (    Integer storageID : defaultStorageData.getStorageVA()) {
      ClusterNode node=new ClusterNode(tree,get(storageID).getLabel(),count++,false,storageID);
      tree.addChild(tree.getRoot(),node);
    }
    tree.getRoot().createMetaSets(this);
  }
  hashStorageData.put(StorageVAType.STORAGE,defaultStorageData.clone());
}

Fixed version (ground truth):
void finalizeAddedStorages(){
  if ((this.getClass().equals(Set.class))) {
    Tree<ClusterNode> tree=defaultStorageData.getStorageTree();
    int count=1;
    for (    Integer storageID : defaultStorageData.getStorageVA()) {
      ClusterNode node=new ClusterNode(tree,get(storageID).getLabel(),count++,false,storageID);
      tree.addChild(tree.getRoot(),node);
    }
    tree.getRoot().createMetaSets(this);
  }
  hashStorageData.put(STORAGE,defaultStorageData.clone());
}
Program: 58161
Project: 58161
Buggy source:
public static SetRelations compareSets(ISet setLeft,ISet setRight){
  SetRelations setRelations=new SetRelations(setLeft,setRight);
  ContentVirtualArray contentVALeft=setLeft.getContentData(ContentVAType.CONTENT).getContentVA();
  ContentVirtualArray contentVARight=setRight.getContentData(ContentVAType.CONTENT).getContentVA();
  HashMap<Integer,Integer> hashRightIndices=new HashMap<Integer,Integer>();
  int rightIndex=0;
  for (  Integer rightID : contentVARight) {
    hashRightIndices.put(rightID,rightIndex++);
  }
  int leftIndex=0;
  for (  Integer leftID : contentVALeft) {
    setRelations.hashLeftToRight.put(leftIndex,hashRightIndices.get(leftID));
    setRelations.hashRightToLeft.put(hashRightIndices.get(leftID),leftIndex);
    leftIndex++;
  }
  return setRelations;
}

Fixed version (ground truth):
public static SetRelations compareSets(ISet setLeft,ISet setRight){
  SetRelations setRelations=new SetRelations(setLeft,setRight);
  ContentVirtualArray contentVALeft=setLeft.getContentData(Set.CONTENT).getContentVA();
  ContentVirtualArray contentVARight=setRight.getContentData(Set.CONTENT).getContentVA();
  HashMap<Integer,Integer> hashRightIndices=new HashMap<Integer,Integer>();
  int rightIndex=0;
  for (  Integer rightID : contentVARight) {
    hashRightIndices.put(rightID,rightIndex++);
  }
  int leftIndex=0;
  for (  Integer leftID : contentVALeft) {
    setRelations.hashLeftToRight.put(leftIndex,hashRightIndices.get(leftID));
    setRelations.hashRightToLeft.put(hashRightIndices.get(leftID),leftIndex);
    leftIndex++;
  }
  return setRelations;
}
Program: 58162
Project: 58162
Buggy source:
@Override public void handleVAUpdate(ContentVADelta delta,String info){
  super.handleVAUpdate(delta,info);
  if (delta.getVAType() == ContentVAType.CONTENT_CONTEXT && contentVAType == ContentVAType.CONTENT_CONTEXT) {
    ClusterState state=new ClusterState(EClustererAlgo.AFFINITY_PROPAGATION,EClustererType.CONTENT_CLUSTERING,EDistanceMeasure.EUCLIDEAN_DISTANCE);
    int contentVAID=contentVA.getID();
    state.setContentVA(contentVA);
    state.setStorageVA(storageVA);
    state.setAffinityPropClusterFactorGenes(4.0f);
    ClusterManager clusterManger=new ClusterManager(set);
    ClusterResult result=clusterManger.cluster(state);
    contentVA=result.getContentResult().getContentVA();
    contentSelectionManager.setVA(contentVA);
    contentVA.setID(contentVAID);
  }
}

Fixed version (ground truth):
@Override public void handleVAUpdate(ContentVADelta delta,String info){
  super.handleVAUpdate(delta,info);
  if (delta.getVAType() == ContentVAType.CONTENT_CONTEXT && contentVAType == ContentVAType.CONTENT_CONTEXT) {
    ClusterState state=new ClusterState(EClustererAlgo.AFFINITY_PROPAGATION,EClustererType.CONTENT_CLUSTERING,EDistanceMeasure.EUCLIDEAN_DISTANCE);
    int contentVAID=contentVA.getID();
    if (contentVA.size() == 0 || storageVA.size() == 0)     return;
    state.setContentVA(contentVA);
    state.setStorageVA(storageVA);
    state.setAffinityPropClusterFactorGenes(4.0f);
    ClusterManager clusterManger=new ClusterManager(set);
    ClusterResult result=clusterManger.cluster(state);
    contentVA=result.getContentResult().getContentVA();
    contentSelectionManager.setVA(contentVA);
    contentVA.setID(contentVAID);
  }
}
Program: 58163
Project: 58163
Buggy source:
@Override protected void handlePickingEvents(EPickingType ePickingType,EPickingMode pickingMode,int iExternalID,Pick pick){
  if (detailLevel == DetailLevel.VERY_LOW) {
    return;
  }
  SelectionType selectionType;
switch (ePickingType) {
case TREEMAP_ELEMENT_SELECTED:
    ATreeMapNode node;
switch (pickingMode) {
case CLICKED:
    break;
case MOUSE_OVER:
  selectionType=SelectionType.MOUSE_OVER;
System.out.println("String_Node_Str" + iExternalID);
mouseOverClusterId=iExternalID;
treeSelectionManager.clearSelection(SelectionType.MOUSE_OVER);
treeSelectionManager.addToType(SelectionType.MOUSE_OVER,iExternalID);
break;
case RIGHT_CLICKED:
break;
case DRAGGED:
selectionType=SelectionType.SELECTION;
break;
default :
return;
}
setHighLichtingListDirty();
break;
default :
return;
}
}

Fixed version (ground truth):
@Override protected void handlePickingEvents(EPickingType ePickingType,EPickingMode pickingMode,int iExternalID,Pick pick){
  if (detailLevel == DetailLevel.VERY_LOW) {
    return;
  }
  SelectionType selectionType;
switch (ePickingType) {
case TREEMAP_ELEMENT_SELECTED:
    ATreeMapNode node;
switch (pickingMode) {
case CLICKED:
    break;
case MOUSE_OVER:
  selectionType=SelectionType.MOUSE_OVER;
mouseOverClusterId=iExternalID;
treeSelectionManager.clearSelection(SelectionType.MOUSE_OVER);
treeSelectionManager.addToType(SelectionType.MOUSE_OVER,iExternalID);
break;
case RIGHT_CLICKED:
break;
case DRAGGED:
selectionType=SelectionType.SELECTION;
break;
default :
return;
}
setHighLichtingListDirty();
break;
default :
return;
}
}
Program: 58164
Project: 58164
Buggy source:
public void mousePressed(MouseEvent e){
  if (e.getButton() == MouseEvent.BUTTON1) {
    treeSelectionManager.clearSelection(SelectionType.SELECTION);
    treeSelectionManager.addToType(SelectionType.SELECTION,mouseOverClusterId);
    bIsMouseWheeleUsed=true;
  }
}

Fixed version (ground truth):
public void mousePressed(MouseEvent e){
  if (e.getButton() == MouseEvent.BUTTON1) {
    treeSelectionManager.clearSelection(SelectionType.SELECTION);
    treeSelectionManager.addToType(SelectionType.SELECTION,mouseOverClusterId);
    bIsMouseWheeleUsed=true;
    mouseWheeleSelectionHeight=0;
  }
}
Program: 58166
Project: 58166
Buggy source:
@Override public void mouseWheelMoved(MouseWheelEvent e){
  if (bIsMouseWheeleUsed) {
    System.out.println("String_Node_Str" + e.getWheelRotation());
    if (e.getWheelRotation() > 0) {
      ATreeMapNode node=treeMapModel.getNodeByNumber(mouseOverClusterId);
      mouseWheeleSelectionHeight++;
      System.out.println("String_Node_Str" + node.selectionLevel);
      ATreeMapNode parent=node.getParentWithLevel(node.getHierarchyLevel() - mouseWheeleSelectionHeight);
      if (parent != null) {
        treeSelectionManager.clearSelection(SelectionType.SELECTION);
        treeSelectionManager.addToType(SelectionType.SELECTION,parent.getID());
      }
 else {
        mouseWheeleSelectionHeight--;
      }
    }
 else {
      ATreeMapNode node=treeMapModel.getNodeByNumber(mouseOverClusterId);
      if (mouseWheeleSelectionHeight > 0) {
        mouseWheeleSelectionHeight--;
        ATreeMapNode parent;
        if (mouseWheeleSelectionHeight == 0)         parent=node;
 else         parent=node.getParentWithLevel(node.getHierarchyLevel() - mouseWheeleSelectionHeight);
        treeSelectionManager.clearSelection(SelectionType.SELECTION);
        treeSelectionManager.addToType(SelectionType.SELECTION,parent.getID());
      }
    }
    setHighLichtingListDirty();
  }
}

Fixed version (ground truth):
@Override public void mouseWheelMoved(MouseWheelEvent e){
  if (bIsMouseWheeleUsed) {
    if (e.getWheelRotation() > 0) {
      ATreeMapNode node=treeMapModel.getNodeByNumber(mouseOverClusterId);
      mouseWheeleSelectionHeight++;
      ATreeMapNode parent=node.getParentWithLevel(node.getHierarchyLevel() - mouseWheeleSelectionHeight);
      if (parent != null) {
        treeSelectionManager.clearSelection(SelectionType.SELECTION);
        treeSelectionManager.addToType(SelectionType.SELECTION,parent.getID());
      }
 else {
        mouseWheeleSelectionHeight--;
      }
    }
 else {
      ATreeMapNode node=treeMapModel.getNodeByNumber(mouseOverClusterId);
      if (mouseWheeleSelectionHeight > 0) {
        mouseWheeleSelectionHeight--;
        ATreeMapNode parent;
        if (mouseWheeleSelectionHeight == 0)         parent=node;
 else         parent=node.getParentWithLevel(node.getHierarchyLevel() - mouseWheeleSelectionHeight);
        treeSelectionManager.clearSelection(SelectionType.SELECTION);
        treeSelectionManager.addToType(SelectionType.SELECTION,parent.getID());
      }
    }
    setHighLichtingListDirty();
  }
}
Program: 58167
Project: 58167
Buggy source:
public static ClusterTreeMapNode createFromClusterNodeTree(ClusterNode clusterNode,ColorMapping colorMapper){
  if (clusterNode != null) {
    Tree<ATreeMapNode> tree=new Tree<ATreeMapNode>();
    ClusterTreeMapNode treemapNode=new ClusterTreeMapNode();
    ClusterReferenzData referenz=new ClusterReferenzData();
    referenz.colorMapper=colorMapper;
    tree.setRootNode(treemapNode);
    treemapNode.setTree(tree);
    treemapNode.data=clusterNode;
    treemapNode.referenzData=referenz;
    try {
      referenz.sizeGetMehtod=clusterNode.getClass().getMethod("String_Node_Str",new Class[0]);
    }
 catch (    SecurityException e) {
      e.printStackTrace();
    }
catch (    NoSuchMethodException e) {
      e.printStackTrace();
    }
    createHelp(treemapNode,clusterNode,referenz);
    return treemapNode;
  }
  return null;
}

Fixed version (ground truth):
public static ClusterTreeMapNode createFromClusterNodeTree(ClusterNode clusterNode,ColorMapping colorMapper){
  if (clusterNode != null) {
    Tree<ATreeMapNode> tree=new Tree<ATreeMapNode>();
    ClusterTreeMapNode treemapNode=new ClusterTreeMapNode();
    ClusterReferenzData referenz=new ClusterReferenzData();
    referenz.sizeReferenzValue=0;
    referenz.colorMapper=colorMapper;
    tree.setRootNode(treemapNode);
    treemapNode.setTree(tree);
    treemapNode.data=clusterNode;
    treemapNode.referenzData=referenz;
    try {
      referenz.sizeGetMehtod=clusterNode.getClass().getMethod("String_Node_Str",new Class[0]);
    }
 catch (    SecurityException e) {
      e.printStackTrace();
    }
catch (    NoSuchMethodException e) {
      e.printStackTrace();
    }
    createHelp(treemapNode,clusterNode,referenz);
    return treemapNode;
  }
  return null;
}
Program: 58168
Project: 58168
Buggy source:
void initialize(){
  preferenceStore=new PreferenceStore(GeneralManager.CALEYDO_HOME_PATH + PREFERENCE_FILE_NAME);
  initializeDefaultPreferences();
  try {
    if (GeneralManager.VERSION == null)     throw new IllegalStateException("String_Node_Str");
    preferenceStore.load();
    String sStoredVersion=preferenceStore.getString(PreferenceConstants.VERSION);
    if (sStoredVersion.equals("String_Node_Str") || (new Integer(sStoredVersion.substring(0,1)) <= new Integer(GeneralManager.VERSION.substring(0,1)) && new Integer(sStoredVersion.substring(2,3)) < new Integer(GeneralManager.VERSION.substring(2,3)))) {
      MessageBox messageBox=new MessageBox(new Shell(),SWT.OK);
      messageBox.setText("String_Node_Str");
      messageBox.setMessage("String_Node_Str" + GeneralManager.VERSION + "String_Node_Str");
      messageBox.open();
      FileOperations.deleteDir(new File(GeneralManager.CALEYDO_HOME_PATH));
      initCaleydoFolder();
    }
  }
 catch (  IOException e) {
    initCaleydoFolder();
  }
  if (preferenceStore.getBoolean(PreferenceConstants.USE_PROXY)) {
    System.setProperty("String_Node_Str",preferenceStore.getString(PreferenceConstants.PROXY_SERVER));
    System.setProperty("String_Node_Str",preferenceStore.getString(PreferenceConstants.PROXY_PORT));
  }
}

Fixed version (ground truth):
void initialize(){
  preferenceStore=new PreferenceStore(GeneralManager.CALEYDO_HOME_PATH + PREFERENCE_FILE_NAME);
  initializeDefaultPreferences();
  try {
    if (GeneralManager.VERSION == null)     throw new IllegalStateException("String_Node_Str");
    preferenceStore.load();
    String sStoredVersion=preferenceStore.getString(PreferenceConstants.VERSION);
    if (sStoredVersion.equals("String_Node_Str") || (new Integer(sStoredVersion.substring(0,1)) <= new Integer(GeneralManager.VERSION.substring(0,1)) && new Integer(sStoredVersion.substring(2,3)) < new Integer(GeneralManager.VERSION.substring(2,3)))) {
      MessageBox messageBox=new MessageBox(new Shell(),SWT.OK);
      messageBox.setText("String_Node_Str");
      messageBox.setMessage("String_Node_Str" + GeneralManager.VERSION + "String_Node_Str");
      messageBox.open();
      FileOperations.deleteDirectory(new File(GeneralManager.CALEYDO_HOME_PATH));
      initCaleydoFolder();
    }
  }
 catch (  IOException e) {
    initCaleydoFolder();
  }
  if (preferenceStore.getBoolean(PreferenceConstants.USE_PROXY)) {
    System.setProperty("String_Node_Str",preferenceStore.getString(PreferenceConstants.PROXY_SERVER));
    System.setProperty("String_Node_Str",preferenceStore.getString(PreferenceConstants.PROXY_PORT));
  }
}
Program: 58170
Project: 58170
Buggy source:
/** 
 * Saves the project into a specified zip-archive.
 * @param fileName name of the file to save the project in.
 */
public void save(String fileName){
  ZipUtils zipUtils=new ZipUtils();
  prepareDirectory(TEMP_PROJECT_DIR_NAME);
  savePluginData(TEMP_PROJECT_DIR_NAME);
  saveProjectData(TEMP_PROJECT_DIR_NAME);
  saveViewData(TEMP_PROJECT_DIR_NAME);
  zipUtils.zipDirectory(TEMP_PROJECT_DIR_NAME,fileName);
  zipUtils.deleteDirectory(TEMP_PROJECT_DIR_NAME);
}

Fixed version (ground truth):
/** 
 * Saves the project into a specified zip-archive.
 * @param fileName name of the file to save the project in.
 */
public void save(String fileName){
  ;
  FileOperations.createDirectory(TEMP_PROJECT_DIR_NAME);
  savePluginData(TEMP_PROJECT_DIR_NAME);
  saveProjectData(TEMP_PROJECT_DIR_NAME);
  saveViewData(TEMP_PROJECT_DIR_NAME);
  ZipUtils zipUtils=new ZipUtils();
  zipUtils.zipDirectory(TEMP_PROJECT_DIR_NAME,fileName);
  FileOperations.deleteDirectory(TEMP_PROJECT_DIR_NAME);
}
Program: 58171
Project: 58171
Buggy source:
/** 
 * Saves the project to the directory for the recent project
 */
public void saveRecentProject(){
  prepareDirectory(RECENT_PROJECT_DIR_NAME);
  savePluginData(RECENT_PROJECT_DIR_NAME);
  saveProjectData(RECENT_PROJECT_DIR_NAME);
  saveViewData(RECENT_PROJECT_DIR_NAME);
}

Fixed version (ground truth):
/** 
 * Saves the project to the directory for the recent project
 */
public void saveRecentProject(){
  if (new File(RECENT_PROJECT_DIR_NAME).exists())   FileOperations.renameDirectory(RECENT_PROJECT_DIR_NAME,RECENT_PROJECT_DIR_NAME_TMP);
  FileOperations.createDirectory(RECENT_PROJECT_DIR_NAME);
  savePluginData(RECENT_PROJECT_DIR_NAME);
  saveProjectData(RECENT_PROJECT_DIR_NAME);
  FileOperations.deleteDirectory(RECENT_PROJECT_DIR_NAME_TMP);
  saveViewData(RECENT_PROJECT_DIR_NAME);
}
Program: 58172
Project: 58172
Buggy source:
private SerializationManager(){
  try {
    Collection<Class<? extends AEvent>> eventTypes=getSerializeableEventTypes();
    projectTypes=new ArrayList<Class<?>>();
    projectTypes.add(DataInitializationData.class);
    projectTypes.add(DataDomainList.class);
    projectTypes.add(ViewList.class);
    projectTypes.add(ASerializedView.class);
    Class<?>[] classes=new Class<?>[eventTypes.size()];
    classes=eventTypes.toArray(classes);
    eventContext=JAXBContext.newInstance(classes);
    createNewProjectContext();
  }
 catch (  JAXBException ex) {
    throw new RuntimeException("String_Node_Str",ex);
  }
}

Fixed version (ground truth):
private SerializationManager(){
  try {
    Collection<Class<? extends AEvent>> eventTypes=getSerializeableEventTypes();
    projectTypes=new ArrayList<Class<?>>();
    projectTypes.add(DataInitializationData.class);
    projectTypes.add(DataDomainList.class);
    projectTypes.add(ViewList.class);
    Class<?>[] classes=new Class<?>[eventTypes.size()];
    classes=eventTypes.toArray(classes);
    eventContext=JAXBContext.newInstance(classes);
    createNewProjectContext();
  }
 catch (  JAXBException ex) {
    throw new RuntimeException("String_Node_Str",ex);
  }
}
Program: 58173
Project: 58173
Buggy source:
/** 
 * Every use case needs to state all ID Categories it can handle. The string must specify which primary VAType (  {@link VAType#getPrimaryVAType()} is associated for the ID Category
 */
@Override public String getDataDomainType(){
  return dataDomainType;
}

Fixed version (ground truth):
@Override public String getDataDomainType(){
  return dataDomainType;
}
Program: 58174
Project: 58174
Buggy source:
public ASetBasedDataDomain(String dataDomainType){
  this.dataDomainType=dataDomainType;
  eventPublisher=GeneralManager.get().getEventPublisher();
  registerEventListeners();
  init();
}

Fixed version (ground truth):
public ASetBasedDataDomain(String dataDomainType){
  super();
  this.dataDomainType=dataDomainType;
  eventPublisher=GeneralManager.get().getEventPublisher();
  registerEventListeners();
  init();
}
Program: 58175
Project: 58175
Buggy source:
/** 
 * Creates the plug-in, registeres all the types needed for serialization, and loads the id mapping.
 */
@Override public void start(BundleContext context) throws Exception {
  super.start(context);
  plugin=this;
  SerializationManager.get().registerSerializableType(GeneticDataDomain.class);
  GeneralManager.get().getXmlParserManager().parseXmlFileByName("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Creates the plug-in, registeres all the types needed for serialization, and loads the id mapping.
 */
@Override public void start(BundleContext context) throws Exception {
  super.start(context);
  plugin=this;
  SerializationManager.get().registerSerializableType(GeneticDataDomain.class);
}
Program: 58176
Project: 58176
Buggy source:
/** 
 * Set a virtual array delta to reflect changes to be made due to VA operations in the selection manager. When the virtual array is managed by the selection manager the delta is also applied to the virtual array.
 * @param delta the delta containing the changes
 */
public void setVADelta(VADelta delta){
  if (virtualArray == null)   return;
  if (delta.getIDType() == iDType) {
    for (    VADeltaItem item : delta) {
switch (item.getType()) {
case REMOVE_ELEMENT:
        remove(item.getPrimaryID(),false);
      break;
case REMOVE:
    remove(virtualArray.get(item.getIndex()),false);
  break;
}
}
virtualArray.setDelta(delta);
}
}

Fixed version (ground truth):
/** 
 * Set a virtual array delta to reflect changes to be made due to VA operations in the selection manager. When the virtual array is managed by the selection manager the delta is also applied to the virtual array.
 * @param delta the delta containing the changes
 */
public void setVADelta(VADelta delta){
  if (virtualArray == null)   return;
  VADelta localDelta;
  if (delta.getIDType().getIDCategory() != iDType.getIDCategory())   throw new IllegalStateException("String_Node_Str");
  if (delta.getIDType() != iDType)   localDelta=DeltaConverter.convertDelta(iDType,delta);
 else   localDelta=delta;
  for (  VADeltaItem item : localDelta) {
switch (item.getType()) {
case REMOVE_ELEMENT:
      remove(item.getPrimaryID(),false);
    break;
case REMOVE:
  remove(virtualArray.get(item.getIndex()),false);
break;
}
}
virtualArray.setDelta(localDelta);
}
Program: 58177
Project: 58177
Buggy source:
private void runContentClustering(AClusterer clusterer,ClusterState clusterState,ClusterResult result,int progressBarOffset,int progressBarMulti){
  clusterer.setClusterState(clusterState);
  TempResult tempResult=clusterer.getSortedVA(set,clusterState,progressBarOffset,progressBarMulti);
  result.contentResult=new ContentData(set.getDataDomain().getContentIDType());
  result.contentResult.setContentVA(new ContentVirtualArray(clusterState.getContentVAType(),tempResult.indices));
  result.contentResult.setContentClusterSizes(tempResult.clusterSizes);
  result.contentResult.setContentSampleElements(tempResult.sampleElements);
  tempResult.tree.initializeIDTypes(clusterState.getContentIDType());
  result.contentResult.setContentTree(tempResult.tree);
}

Fixed version (ground truth):
private void runContentClustering(AClusterer clusterer,ClusterState clusterState,ClusterResult result,int progressBarOffset,int progressBarMulti){
  clusterer.setClusterState(clusterState);
  TempResult tempResult=clusterer.getSortedVA(set,clusterState,progressBarOffset,progressBarMulti);
  result.contentResult=new ContentData(set.getDataDomain().getContentIDType());
  result.contentResult.setContentVA(new ContentVirtualArray(clusterState.getContentVAType(),tempResult.indices));
  result.contentResult.setContentClusterSizes(tempResult.clusterSizes);
  result.contentResult.setContentSampleElements(tempResult.sampleElements);
  if (tempResult.tree != null) {
    tempResult.tree.initializeIDTypes(clusterState.getContentIDType());
    result.contentResult.setContentTree(tempResult.tree);
  }
}
Program: 58178
Project: 58178
Buggy source:
@Override public void handleContentVAUpdate(ContentVADelta delta,String info){
  contentVA.setGroupList(null);
  reactOnContentVAChanges(delta);
  setDisplayListDirty();
}

Fixed version (ground truth):
@Override public void handleContentVAUpdate(ContentVADelta delta,String info){
  contentVA.setGroupList(null);
  contentSelectionManager.setVADelta(delta);
  reactOnContentVAChanges(delta);
  setDisplayListDirty();
}
Program: 58179
Project: 58179
Buggy source:
@Override public void handleContentVAUpdate(ContentVADelta delta,String info){
  super.handleContentVAUpdate(delta,info);
  if (delta.getVAType() == ContentVAType.CONTENT_CONTEXT && contentVAType == ContentVAType.CONTENT_CONTEXT) {
    if (contentVA.size() == 0)     return;
    AffinityClusterer clusterer=new AffinityClusterer();
    ClusterState state=new ClusterState(EClustererAlgo.AFFINITY_PROPAGATION,EClustererType.CONTENT_CLUSTERING,EDistanceMeasure.EUCLIDEAN_DISTANCE);
    int contentVAID=contentVA.getID();
    state.setContentVA(contentVA);
    state.setStorageVA(storageVA);
    state.setAffinityPropClusterFactorGenes(4.0f);
    ClusterManager clusterManger=new ClusterManager(set);
    ClusterResult result=clusterManger.cluster(state);
    contentVA=result.getContentResult().getContentVA();
    contentSelectionManager.setVA(contentVA);
    contentVA.setID(contentVAID);
  }
}

Fixed version (ground truth):
@Override public void handleContentVAUpdate(ContentVADelta delta,String info){
  super.handleContentVAUpdate(delta,info);
  if (delta.getVAType() == ContentVAType.CONTENT_CONTEXT && contentVAType == ContentVAType.CONTENT_CONTEXT) {
    AffinityClusterer clusterer=new AffinityClusterer();
    ClusterState state=new ClusterState(EClustererAlgo.AFFINITY_PROPAGATION,EClustererType.CONTENT_CLUSTERING,EDistanceMeasure.EUCLIDEAN_DISTANCE);
    int contentVAID=contentVA.getID();
    state.setContentVA(contentVA);
    state.setStorageVA(storageVA);
    state.setAffinityPropClusterFactorGenes(4.0f);
    ClusterManager clusterManger=new ClusterManager(set);
    ClusterResult result=clusterManger.cluster(state);
    contentVA=result.getContentResult().getContentVA();
    contentSelectionManager.setVA(contentVA);
    contentVA.setID(contentVAID);
  }
}
Program: 58181
Project: 58181
Buggy source:
private float[] determineNodeColor(PathwayVertexGraphItemRep vertexRep){
  int iDavidID=pathwayItemManager.getDavidIdByPathwayVertexGraphItem((PathwayVertexGraphItem)vertexRep.getAllItemsByProp(EGraphItemProperty.ALIAS_PARENT).get(0));
  if (iDavidID == -1 || iDavidID == 0) {
  }
 else {
    for (    Object iExpressionIndex : idMappingManager.<Integer,Object>getIDAsSet(glPathwayView.getDataDomain().getDavidIDType(),glPathwayView.getMappingDataDomain().getContentIDType(),((Integer)iDavidID))) {
      return colorMapper.getColor(geneticDataDomain.getSet().get(glPathwayView.iCurrentStorageIndex).getFloat(EDataRepresentation.NORMALIZED,((Integer)iExpressionIndex).intValue()));
    }
  }
  return null;
}

Fixed version (ground truth):
private float[] determineNodeColor(PathwayVertexGraphItemRep vertexRep){
  int iDavidID=pathwayItemManager.getDavidIdByPathwayVertexGraphItem((PathwayVertexGraphItem)vertexRep.getAllItemsByProp(EGraphItemProperty.ALIAS_PARENT).get(0));
  if (iDavidID == -1 || iDavidID == 0)   return null;
 else {
    Set<Integer> ids=idMappingManager.<Integer,Integer>getIDAsSet(glPathwayView.getDataDomain().getDavidIDType(),glPathwayView.getMappingDataDomain().getContentIDType(),iDavidID);
    if (ids == null)     return null;
    for (    Integer iExpressionIndex : ids) {
      IStorage storage=geneticDataDomain.getSet().get(glPathwayView.iCurrentStorageIndex);
      if (storage == null)       throw new IllegalStateException("String_Node_Str" + glPathwayView.iCurrentStorageIndex);
      float expressionValue=storage.getFloat(EDataRepresentation.NORMALIZED,iExpressionIndex);
      return colorMapper.getColor(expressionValue);
    }
  }
  return null;
}
Program: 58182
Project: 58182
Buggy source:
/** 
 * Load data from file using a token pattern.
 */
public void doCommand(){
  createdObject=new Set();
  createdObject.setLabel(label);
  if (externalID != -1) {
    generalManager.getIDManager().mapInternalToExternalID(createdObject.getID(),externalID);
  }
  fillSets(createdObject);
  generalManager.getLogger().log(new Status(IStatus.INFO,IGeneralManager.PLUGIN_ID,"String_Node_Str" + createdObject.getID() + "String_Node_Str"+ externalID+ "String_Node_Str"));
  dataDomain.setSet(createdObject);
}

Fixed version (ground truth):
/** 
 * Load data from file using a token pattern.
 */
public void doCommand(){
  createdObject=new Set(dataDomain);
  createdObject.setLabel(label);
  if (externalID != -1) {
    generalManager.getIDManager().mapInternalToExternalID(createdObject.getID(),externalID);
  }
  fillSets(createdObject);
  generalManager.getLogger().log(new Status(IStatus.INFO,IGeneralManager.PLUGIN_ID,"String_Node_Str" + createdObject.getID() + "String_Node_Str"+ externalID+ "String_Node_Str"));
  dataDomain.setSet(createdObject);
}
Program: 58183
Project: 58183
Buggy source:
public void finish(){
  if (contentVA != null && contentClusterSizes != null && contentSampleElements != null) {
    isPartitionallyClustered=true;
    ContentGroupList contentGroupList=new ContentGroupList();
    int cnt=0;
    contentTree=new Tree<ClusterNode>();
    contentTree.setUseDefaultComparator(false);
    int clusterNr=0;
    ClusterNode root=new ClusterNode(contentTree,"String_Node_Str",clusterNr++,true,-1);
    contentTree.setRootNode(root);
    ClusterNode node;
    int from=0;
    int to=0;
    for (    Integer clusterSize : contentClusterSizes) {
      node=new ClusterNode(contentTree,"String_Node_Str" + clusterNr,clusterNr++,true,-1);
      Group temp=new Group(clusterSize,false,contentSampleElements.get(cnt),SelectionType.NORMAL,node);
      contentTree.addChild(root,node);
      contentGroupList.append(temp);
      cnt++;
      to+=clusterSize;
      ClusterNode leaf;
      for (int vaIndex=from; vaIndex < to; vaIndex++) {
        Integer contentID=contentVA.get(vaIndex);
        leaf=new ClusterNode(contentTree,"String_Node_Str" + contentID,clusterNr++,true,contentID);
        contentTree.addChild(node,leaf);
      }
      from=to;
    }
    contentVA.setGroupList(contentGroupList);
  }
 else   if (contentVA != null && contentTree != null) {
    contentVA.buildNewGroupList(contentTree.getRoot().getChildren());
  }
  contentTree.setUseDefaultComparator(false);
}

Fixed version (ground truth):
public void finish(){
  if (contentVA != null && contentClusterSizes != null && contentSampleElements != null) {
    isPartitionallyClustered=true;
    ContentGroupList contentGroupList=new ContentGroupList();
    int cnt=0;
    contentTree=new Tree<ClusterNode>(contentIDIdType);
    contentTree.setUseDefaultComparator(false);
    int clusterNr=0;
    ClusterNode root=new ClusterNode(contentTree,"String_Node_Str",clusterNr++,true,-1);
    contentTree.setRootNode(root);
    ClusterNode node;
    int from=0;
    int to=0;
    for (    Integer clusterSize : contentClusterSizes) {
      node=new ClusterNode(contentTree,"String_Node_Str" + clusterNr,clusterNr++,true,-1);
      Group temp=new Group(clusterSize,false,contentSampleElements.get(cnt),SelectionType.NORMAL,node);
      contentTree.addChild(root,node);
      contentGroupList.append(temp);
      cnt++;
      to+=clusterSize;
      ClusterNode leaf;
      for (int vaIndex=from; vaIndex < to; vaIndex++) {
        Integer contentID=contentVA.get(vaIndex);
        leaf=new ClusterNode(contentTree,"String_Node_Str" + contentID,clusterNr++,true,contentID);
        contentTree.addChild(node,leaf);
      }
      from=to;
    }
    contentVA.setGroupList(contentGroupList);
  }
 else   if (contentVA != null && contentTree != null) {
    contentVA.buildNewGroupList(contentTree.getRoot().getChildren());
  }
  contentTree.setUseDefaultComparator(false);
}