Program: 58939
Project: 58939
Buggy source:
@Override protected void handleEvents(EPickingType ePickingType,EPickingMode pickingMode,int iExternalID,Pick pick){
  if (detailLevel == EDetailLevel.VERY_LOW) {
    pickingManager.flushHits(iUniqueID,ePickingType);
    return;
  }
switch (ePickingType) {
case PATHWAY_ELEMENT_SELECTION:
    ESelectionType eSelectionType;
  PathwayVertexGraphItemRep tmpVertexGraphItemRep=(PathwayVertexGraphItemRep)generalManager.getPathwayItemManager().getItem(iExternalID);
setDisplayListDirty();
selectionManager.clearSelection(ESelectionType.NEIGHBORHOOD_1);
selectionManager.clearSelection(ESelectionType.NEIGHBORHOOD_2);
selectionManager.clearSelection(ESelectionType.NEIGHBORHOOD_3);
switch (pickingMode) {
case DOUBLE_CLICKED:
eSelectionType=ESelectionType.SELECTION;
if (tmpVertexGraphItemRep.getType() == EPathwayVertexType.map) {
int iPathwayID=generalManager.getPathwayManager().searchPathwayIdByName(tmpVertexGraphItemRep.getName(),EPathwayDatabaseType.KEGG);
if (iPathwayID != -1) {
IDListEventContainer<Integer> idListEventContainer=new IDListEventContainer<Integer>(EEventType.LOAD_PATHWAY_BY_PATHWAY_ID,EIDType.PATHWAY);
idListEventContainer.addID(iPathwayID);
triggerEvent(EMediatorType.SELECTION_MEDIATOR,idListEventContainer);
}
}
 else {
IDListEventContainer<Integer> idListEventContainer=new IDListEventContainer<Integer>(EEventType.LOAD_PATHWAY_BY_GENE,EIDType.DAVID);
ArrayList<Integer> alDavids=getDavidFromPathwayVertexGraphItemRep(tmpVertexGraphItemRep.getID());
idListEventContainer.setIDs(alDavids);
triggerEvent(EMediatorType.SELECTION_MEDIATOR,idListEventContainer);
}
break;
case CLICKED:
eSelectionType=ESelectionType.SELECTION;
break;
case MOUSE_OVER:
eSelectionType=ESelectionType.MOUSE_OVER;
break;
default :
pickingManager.flushHits(iUniqueID,ePickingType);
return;
}
selectionManager.clearSelection(eSelectionType);
selectionManager.addToType(eSelectionType,tmpVertexGraphItemRep.getId());
int iConnectionID=generalManager.getIDManager().createID(EManagedObjectType.CONNECTION);
selectionManager.addConnectionID(iConnectionID,tmpVertexGraphItemRep.getId());
connectedElementRepresentationManager.clear(EIDType.EXPRESSION_INDEX);
gLPathwayContentCreator.performIdenticalNodeHighlighting(eSelectionType);
createConnectionLines(eSelectionType,iConnectionID);
triggerEvent(EMediatorType.SELECTION_MEDIATOR,new SelectionCommandEventContainer(EIDType.DAVID,new SelectionCommand(ESelectionCommandType.CLEAR,eSelectionType)));
ISelectionDelta selectionDelta=createExternalSelectionDelta(selectionManager.getDelta());
triggerEvent(EMediatorType.SELECTION_MEDIATOR,new DeltaEventContainer<ISelectionDelta>(selectionDelta));
pickingManager.flushHits(iUniqueID,EPickingType.PATHWAY_ELEMENT_SELECTION);
break;
}
}

Fixed version (ground truth):
@Override protected void handleEvents(EPickingType ePickingType,EPickingMode pickingMode,int iExternalID,Pick pick){
  if (detailLevel == EDetailLevel.VERY_LOW) {
    pickingManager.flushHits(iUniqueID,ePickingType);
    return;
  }
switch (ePickingType) {
case PATHWAY_ELEMENT_SELECTION:
    ESelectionType eSelectionType;
  PathwayVertexGraphItemRep tmpVertexGraphItemRep=(PathwayVertexGraphItemRep)generalManager.getPathwayItemManager().getItem(iExternalID);
setDisplayListDirty();
selectionManager.clearSelection(ESelectionType.NEIGHBORHOOD_1);
selectionManager.clearSelection(ESelectionType.NEIGHBORHOOD_2);
selectionManager.clearSelection(ESelectionType.NEIGHBORHOOD_3);
switch (pickingMode) {
case DOUBLE_CLICKED:
eSelectionType=ESelectionType.SELECTION;
if (tmpVertexGraphItemRep.getType() == EPathwayVertexType.map) {
int iPathwayID=generalManager.getPathwayManager().searchPathwayIdByName(tmpVertexGraphItemRep.getName(),EPathwayDatabaseType.KEGG);
if (iPathwayID != -1) {
IDListEventContainer<Integer> idListEventContainer=new IDListEventContainer<Integer>(EEventType.LOAD_PATHWAY_BY_PATHWAY_ID,EIDType.PATHWAY);
idListEventContainer.addID(iPathwayID);
triggerEvent(EMediatorType.SELECTION_MEDIATOR,idListEventContainer);
}
}
 else {
IDListEventContainer<Integer> idListEventContainer=new IDListEventContainer<Integer>(EEventType.LOAD_PATHWAY_BY_GENE,EIDType.REFSEQ_MRNA_INT);
ArrayList<Integer> alRefSeqID=getRefSeqIDsFromPathwayVertexGraphItemRep(tmpVertexGraphItemRep.getID());
idListEventContainer.setIDs(alRefSeqID);
triggerEvent(EMediatorType.SELECTION_MEDIATOR,idListEventContainer);
}
break;
case CLICKED:
eSelectionType=ESelectionType.SELECTION;
break;
case MOUSE_OVER:
eSelectionType=ESelectionType.MOUSE_OVER;
break;
default :
pickingManager.flushHits(iUniqueID,ePickingType);
return;
}
selectionManager.clearSelection(eSelectionType);
selectionManager.addToType(eSelectionType,tmpVertexGraphItemRep.getId());
int iConnectionID=generalManager.getIDManager().createID(EManagedObjectType.CONNECTION);
selectionManager.addConnectionID(iConnectionID,tmpVertexGraphItemRep.getId());
connectedElementRepresentationManager.clear(EIDType.EXPRESSION_INDEX);
gLPathwayContentCreator.performIdenticalNodeHighlighting(eSelectionType);
createConnectionLines(eSelectionType,iConnectionID);
triggerEvent(EMediatorType.SELECTION_MEDIATOR,new SelectionCommandEventContainer(EIDType.DAVID,new SelectionCommand(ESelectionCommandType.CLEAR,eSelectionType)));
ISelectionDelta selectionDelta=createExternalSelectionDelta(selectionManager.getDelta());
triggerEvent(EMediatorType.SELECTION_MEDIATOR,new DeltaEventContainer<ISelectionDelta>(selectionDelta));
pickingManager.flushHits(iUniqueID,EPickingType.PATHWAY_ELEMENT_SELECTION);
break;
}
}