Program: 57214
Project: 57214
Buggy source:
private void selectPath(PathwayVertexRep vertexRep,SelectionType selectionType){
  if (vertexRep == null)   return;
  boolean triggerPathUpdate=false;
  if (!isPathStartSelected) {
    if (isControlKeyDown) {
      shrinkSelectedPath(vertexRep);
      if (selectionType == SelectionType.SELECTION) {
        previousSelectedPath=selectedPath;
      }
      triggerPathUpdate=true;
    }
    if (isShiftKeyDown) {
      extendSelectedPath(vertexRep);
      if (selectionType == SelectionType.SELECTION) {
        previousSelectedPath=selectedPath;
      }
      triggerPathUpdate=true;
    }
    if (!isShiftKeyDown && !isControlKeyDown && vertexRep != null) {
      if (selectionType == SelectionType.SELECTION) {
        boolean isPortalNode=false;
        portalVertexReps=PathwayManager.get().getEquivalentVertexRepsInPathway(previousSelectedPath.getEndVertex(),pathway);
        for (        PathwayVertexRep portal : portalVertexReps) {
          if (vertexRep == portal) {
            isPortalNode=true;
          }
        }
        if (!isPortalNode) {
          pathSegments.clear();
        }
        generateSingleNodePath(vertexRep);
        pathSegments.add(new PathwayPath(selectedPath));
        isPathStartSelected=true;
        triggerPathUpdate=true;
      }
    }
  }
 else {
    if (pathStartVertexRep == null)     return;
    if (!pathway.containsVertex(pathStartVertexRep)) {
      isPathStartSelected=false;
      return;
    }
    KShortestPaths<PathwayVertexRep,DefaultEdge> pathAlgo=new KShortestPaths<PathwayVertexRep,DefaultEdge>(pathway,pathStartVertexRep,MAX_PATHS);
    List<GraphPath<PathwayVertexRep,DefaultEdge>> allPathsTmp=null;
    if (vertexRep != null) {
      if (vertexRep != pathStartVertexRep) {
        allPathsTmp=pathAlgo.getPaths(vertexRep);
        if (allPathsTmp != null && allPathsTmp.size() > 0) {
          allPaths=allPathsTmp;
          if (allPaths.size() <= selectedPathID)           selectedPathID=0;
          selectedPath=allPaths.get(selectedPathID);
          triggerPathUpdate=true;
        }
      }
 else {
        generateSingleNodePath(vertexRep);
      }
    }
    if (pathSegments.size() > 0)     pathSegments.set(pathSegments.size() - 1,new PathwayPath(selectedPath));
    if (selectionType == SelectionType.SELECTION) {
      isPathStartSelected=false;
      previousSelectedPath=selectedPath;
    }
  }
  if (triggerPathUpdate) {
    triggerPathUpdate();
    isBubbleTextureDirty=true;
  }
}

Fixed version (ground truth):
private void selectPath(PathwayVertexRep vertexRep,SelectionType selectionType){
  if (vertexRep == null)   return;
  boolean triggerPathUpdate=false;
  if (!isPathStartSelected) {
    if (isControlKeyDown) {
      shrinkSelectedPath(vertexRep);
      if (selectionType == SelectionType.SELECTION) {
        previousSelectedPath=selectedPath;
      }
      triggerPathUpdate=true;
    }
    if (isShiftKeyDown) {
      extendSelectedPath(vertexRep);
      if (selectionType == SelectionType.SELECTION) {
        previousSelectedPath=selectedPath;
      }
      triggerPathUpdate=true;
    }
    if (!isShiftKeyDown && !isControlKeyDown && vertexRep != null) {
      if (selectionType == SelectionType.SELECTION) {
        boolean isPortalNode=false;
        if (previousSelectedPath != null) {
          portalVertexReps=PathwayManager.get().getEquivalentVertexRepsInPathway(previousSelectedPath.getEndVertex(),pathway);
          for (          PathwayVertexRep portal : portalVertexReps) {
            if (vertexRep == portal) {
              isPortalNode=true;
            }
          }
        }
        if (!isPortalNode) {
          pathSegments.clear();
        }
        generateSingleNodePath(vertexRep);
        pathSegments.add(new PathwayPath(selectedPath));
        isPathStartSelected=true;
        triggerPathUpdate=true;
      }
    }
  }
 else {
    if (pathStartVertexRep == null)     return;
    if (!pathway.containsVertex(pathStartVertexRep)) {
      isPathStartSelected=false;
      return;
    }
    KShortestPaths<PathwayVertexRep,DefaultEdge> pathAlgo=new KShortestPaths<PathwayVertexRep,DefaultEdge>(pathway,pathStartVertexRep,MAX_PATHS);
    List<GraphPath<PathwayVertexRep,DefaultEdge>> allPathsTmp=null;
    if (vertexRep != null) {
      if (vertexRep != pathStartVertexRep) {
        allPathsTmp=pathAlgo.getPaths(vertexRep);
        if (allPathsTmp != null && allPathsTmp.size() > 0) {
          allPaths=allPathsTmp;
          if (allPaths.size() <= selectedPathID)           selectedPathID=0;
          selectedPath=allPaths.get(selectedPathID);
          triggerPathUpdate=true;
        }
      }
 else {
        generateSingleNodePath(vertexRep);
      }
    }
    if (pathSegments.size() > 0)     pathSegments.set(pathSegments.size() - 1,new PathwayPath(selectedPath));
    if (selectionType == SelectionType.SELECTION) {
      isPathStartSelected=false;
      previousSelectedPath=selectedPath;
    }
  }
  if (triggerPathUpdate) {
    triggerPathUpdate();
    isBubbleTextureDirty=true;
  }
}