Program: 58590
Project: 58590
Buggy source:
/** 
 * Function responsible for handling SelectionDelta for embedded heatmap
 */
private void setEmbeddedHeatMapData(){
  int iCount=iFirstSampleLevel1 + iFirstSampleLevel2;
  if (iCount < 0) {
    System.out.println("String_Node_Str" + iFirstSampleLevel1);
    System.out.println("String_Node_Str" + iFirstSampleLevel2);
    throw new IllegalStateException();
  }
  glHeatMapView.resetView();
  IVirtualArrayDelta delta=new VirtualArrayDelta(EVAType.CONTENT_EMBEDDED_HM,eFieldDataType);
  ISelectionDelta selectionDelta=new SelectionDelta(eFieldDataType);
  IVirtualArray currentVirtualArray=contentVA;
  int iIndex=0;
  int iContentIndex=0;
  int iStorageIndex=0;
  Set<Integer> setMouseOverElements=contentSelectionManager.getElements(ESelectionType.MOUSE_OVER);
  Set<Integer> setSelectedElements=contentSelectionManager.getElements(ESelectionType.SELECTION);
  Set<Integer> setDeselectedElements=contentSelectionManager.getElements(ESelectionType.DESELECTED);
  connectedElementRepresentationManager.clearByView(glHeatMapView.getID());
  for (int index=0; index < iSamplesPerHeatmap; index++) {
    iIndex=iCount + index;
    if (iIndex < currentVirtualArray.size()) {
      iContentIndex=currentVirtualArray.get(iIndex);
    }
    delta.add(VADeltaItem.append(iContentIndex));
    for (    Integer iSelectedID : setMouseOverElements) {
      if (iSelectedID == iContentIndex) {
        selectionDelta.addSelection(iContentIndex,ESelectionType.MOUSE_OVER);
        Collection<Integer> conenctionIDs=contentSelectionManager.getConnectionForElementID(iContentIndex);
        selectionDelta.addConnectionIDs(iSelectedID,conenctionIDs);
      }
    }
    for (    Integer iSelectedID : setSelectedElements) {
      if (iSelectedID == iContentIndex) {
        selectionDelta.addSelection(iContentIndex,ESelectionType.SELECTION);
        Collection<Integer> conenctionIDs=contentSelectionManager.getConnectionForElementID(iContentIndex);
        selectionDelta.addConnectionIDs(iSelectedID,conenctionIDs);
      }
    }
    for (    Integer iSelectedID : setDeselectedElements) {
      if (iSelectedID == iContentIndex)       selectionDelta.addSelection(iContentIndex,ESelectionType.DESELECTED);
    }
  }
  glHeatMapView.handleVirtualArrayUpdate(delta,getShortInfo());
  if (selectionDelta.size() > 0) {
    glHeatMapView.handleSelectionUpdate(selectionDelta,true,null);
  }
  SelectionCommand command=new SelectionCommand(ESelectionCommandType.RESET);
  glHeatMapView.handleStorageTriggerSelectionCommand(eExperimentDataType.getCategory(),command);
  IVirtualArrayDelta deltaExp=new VirtualArrayDelta(storageVAType,eExperimentDataType);
  ISelectionDelta selectionDeltaEx=new SelectionDelta(eExperimentDataType);
  IVirtualArray currentVirtualArrayEx=storageVA;
  setMouseOverElements=storageSelectionManager.getElements(ESelectionType.MOUSE_OVER);
  setSelectedElements=storageSelectionManager.getElements(ESelectionType.SELECTION);
  for (int index=0; index < currentVirtualArrayEx.size(); index++) {
    iStorageIndex=currentVirtualArrayEx.get(index);
    deltaExp.add(VADeltaItem.append(iStorageIndex));
    for (    Integer iSelectedID : setMouseOverElements) {
      if (iSelectedID == iStorageIndex)       selectionDeltaEx.addSelection(iStorageIndex,ESelectionType.MOUSE_OVER);
    }
    for (    Integer iSelectedID : setSelectedElements) {
      if (iSelectedID == iStorageIndex)       selectionDeltaEx.addSelection(iStorageIndex,ESelectionType.SELECTION);
    }
  }
  glHeatMapView.handleVirtualArrayUpdate(deltaExp,getShortInfo());
  if (selectionDeltaEx.size() > 0) {
    glHeatMapView.handleSelectionUpdate(selectionDeltaEx,true,null);
  }
}

Fixed version (ground truth):
/** 
 * Function responsible for handling SelectionDelta for embedded heatmap
 */
private void setEmbeddedHeatMapData(){
  int iCount=iFirstSampleLevel1 + iFirstSampleLevel2;
  if (iCount < 0) {
    System.out.println("String_Node_Str" + iFirstSampleLevel1);
    System.out.println("String_Node_Str" + iFirstSampleLevel2);
    throw new IllegalStateException();
  }
  glHeatMapView.resetView();
  IVirtualArrayDelta delta=new VirtualArrayDelta(EVAType.CONTENT_EMBEDDED_HM,eFieldDataType);
  ISelectionDelta selectionDelta=new SelectionDelta(eFieldDataType);
  IVirtualArray currentVirtualArray=contentVA;
  int iIndex=0;
  int iContentIndex=0;
  int iStorageIndex=0;
  Set<Integer> setMouseOverElements=contentSelectionManager.getElements(ESelectionType.MOUSE_OVER);
  Set<Integer> setSelectedElements=contentSelectionManager.getElements(ESelectionType.SELECTION);
  Set<Integer> setDeselectedElements=contentSelectionManager.getElements(ESelectionType.DESELECTED);
  connectedElementRepresentationManager.clearByView(glHeatMapView.getID());
  connectedElementRepresentationManager.clearByView(this.getID());
  for (int index=0; index < iSamplesPerHeatmap; index++) {
    iIndex=iCount + index;
    if (iIndex < currentVirtualArray.size()) {
      iContentIndex=currentVirtualArray.get(iIndex);
    }
    delta.add(VADeltaItem.append(iContentIndex));
    for (    Integer iSelectedID : setMouseOverElements) {
      if (iSelectedID == iContentIndex) {
        selectionDelta.addSelection(iContentIndex,ESelectionType.MOUSE_OVER);
        Collection<Integer> conenctionIDs=contentSelectionManager.getConnectionForElementID(iContentIndex);
        selectionDelta.addConnectionIDs(iSelectedID,conenctionIDs);
      }
    }
    for (    Integer iSelectedID : setSelectedElements) {
      if (iSelectedID == iContentIndex) {
        selectionDelta.addSelection(iContentIndex,ESelectionType.SELECTION);
        Collection<Integer> conenctionIDs=contentSelectionManager.getConnectionForElementID(iContentIndex);
        selectionDelta.addConnectionIDs(iSelectedID,conenctionIDs);
      }
    }
    for (    Integer iSelectedID : setDeselectedElements) {
      if (iSelectedID == iContentIndex)       selectionDelta.addSelection(iContentIndex,ESelectionType.DESELECTED);
    }
  }
  glHeatMapView.handleVirtualArrayUpdate(delta,getShortInfo());
  if (selectionDelta.size() > 0) {
    glHeatMapView.handleSelectionUpdate(selectionDelta,true,null);
  }
  SelectionCommand command=new SelectionCommand(ESelectionCommandType.RESET);
  glHeatMapView.handleStorageTriggerSelectionCommand(eExperimentDataType.getCategory(),command);
  IVirtualArrayDelta deltaExp=new VirtualArrayDelta(storageVAType,eExperimentDataType);
  ISelectionDelta selectionDeltaEx=new SelectionDelta(eExperimentDataType);
  IVirtualArray currentVirtualArrayEx=storageVA;
  setMouseOverElements=storageSelectionManager.getElements(ESelectionType.MOUSE_OVER);
  setSelectedElements=storageSelectionManager.getElements(ESelectionType.SELECTION);
  for (int index=0; index < currentVirtualArrayEx.size(); index++) {
    iStorageIndex=currentVirtualArrayEx.get(index);
    deltaExp.add(VADeltaItem.append(iStorageIndex));
    for (    Integer iSelectedID : setMouseOverElements) {
      if (iSelectedID == iStorageIndex)       selectionDeltaEx.addSelection(iStorageIndex,ESelectionType.MOUSE_OVER);
    }
    for (    Integer iSelectedID : setSelectedElements) {
      if (iSelectedID == iStorageIndex)       selectionDeltaEx.addSelection(iStorageIndex,ESelectionType.SELECTION);
    }
  }
  glHeatMapView.handleVirtualArrayUpdate(deltaExp,getShortInfo());
  if (selectionDeltaEx.size() > 0) {
    glHeatMapView.handleSelectionUpdate(selectionDeltaEx,true,null);
  }
}