Program: 56813
Project: 56813
Buggy source:
/** 
 * This method has to be called in every display step. It is responsible for the ray tracing which does the actual picking. It needs the ID of the calling view and a gl context. It calls the display() method of the calling view, therefore only elements rendered in the display() can be picked.
 * @param glView a reference to the calling view
 * @param gl the GL2 context
 */
public void handlePicking(final AGLView glView,final GL2 gl){
  if (enablePicking == false)   return;
  GLMouseListener glMouseListener=glView.getGLMouseListener();
  PickingMode ePickingMode=PickingMode.CLICKED;
  if (glMouseListener.wasMouseDoubleClicked()) {
    ePickingMode=PickingMode.DOUBLE_CLICKED;
  }
 else   if (glMouseListener.wasMouseDragged()) {
    ePickingMode=PickingMode.DRAGGED;
  }
 else   if (glMouseListener.wasLeftMouseButtonPressed()) {
    ePickingMode=PickingMode.CLICKED;
  }
 else   if (glMouseListener.wasRightMouseButtonPressed()) {
    ePickingMode=PickingMode.RIGHT_CLICKED;
  }
 else   if (glMouseListener.wasMouseMoved()) {
    hashViewIDToIsMouseOverPickingEvent.put(glView.getID(),true);
    ePickingMode=PickingMode.MOUSE_OVER;
  }
 else   if (hashViewIDToIsMouseOverPickingEvent.get(glView.getID()) != null && hashViewIDToIsMouseOverPickingEvent.get(glView.getID()) == true) {
    return;
  }
 else {
    return;
  }
  Point pickRealPoint=glMouseListener.getRAWPickedPoint();
  if (pickRealPoint == null)   return;
  hashViewIDToIsMouseOverPickingEvent.put(glView.getID(),false);
  int PICKING_BUFSIZE=1024;
  int iArPickingBuffer[]=new int[PICKING_BUFSIZE];
  IntBuffer pickingBuffer=Buffers.newDirectIntBuffer(PICKING_BUFSIZE);
  int iHitCount=-1;
  int viewport[]=new int[4];
  gl.glGetIntegerv(GL.GL_VIEWPORT,viewport,0);
  gl.glSelectBuffer(PICKING_BUFSIZE,pickingBuffer);
  gl.glRenderMode(GL2.GL_SELECT);
  gl.glInitNames();
  gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
  gl.glPushMatrix();
  gl.glLoadIdentity();
  GLU glu=new GLU();
  glu.gluPickMatrix(pickRealPoint.x,(viewport[3] - pickRealPoint.y),5.0,5.0,viewport,0);
  float fAspectRatio=(float)(viewport[3] - viewport[1]) / (float)(viewport[2] - viewport[0]);
  ViewFrustum viewFrustum=glView.getViewFrustum();
  viewFrustum.setProjectionMatrix(gl,fAspectRatio);
  Vec2f pickDIPPoint=glMouseListener.getDIPPickedPoint();
  gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
  gl.glPushMatrix();
  gl.glLoadIdentity();
  glView.display(gl);
  gl.glPopMatrix();
  gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
  gl.glPopMatrix();
  gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
  iHitCount=gl.glRenderMode(GL2.GL_RENDER);
  pickingBuffer.get(iArPickingBuffer);
  ArrayList<Integer> iAlPickedObjectId=processHits(iHitCount,iArPickingBuffer);
  IGLCanvas parentCanvas=glView.getParentGLCanvas();
  if (iAlPickedObjectId.size() > 0) {
    processPicks(iAlPickedObjectId,ePickingMode,pickDIPPoint,glMouseListener.getDIPPickedPointDragStart());
    Set<Integer> processedViews=new HashSet<Integer>();
    for (    int pickingID : iAlPickedObjectId) {
      Pair<Integer,String> pickAssociatedValues=hashPickingIDToViewID.get(pickingID);
      int pickedViewID=pickAssociatedValues.getFirst();
      for (      int viewID : hashViewIDToPreviousViewSpecificHitListContainer.keySet()) {
        if (viewID != pickedViewID && !processedViews.contains(viewID)) {
          AGLView currentView=GeneralManager.get().getViewManager().getGLView(viewID);
          if (currentView != null && currentView.getParentGLCanvas() == parentCanvas) {
            ViewSpecificHitListContainer previousHitContainer=hashViewIDToPreviousViewSpecificHitListContainer.get(viewID);
            if (previousHitContainer != null) {
              for (              String pickingType : previousHitContainer.getPickingTypes()) {
                for (                Pick previousPick : previousHitContainer.getPicksForPickingType(pickingType)) {
                  if (!(glView.getViewType().equals("String_Node_Str")) || (!pickingType.equals(pickAssociatedValues.getSecond()) && previousPick.getObjectID() != getPickedObjectIDFromPickingID(pickedViewID,pickAssociatedValues.getSecond(),pickingID))) {
                    ViewSpecificHitListContainer hitContainer=hashViewIDToViewSpecificHitListContainer.get(viewID);
                    if (hitContainer == null) {
                      hitContainer=new ViewSpecificHitListContainer();
                      hashViewIDToViewSpecificHitListContainer.put(viewID,hitContainer);
                    }
                    Pick pick=new Pick(previousPick.getObjectID(),PickingMode.MOUSE_OUT,pickDIPPoint,glMouseListener.getDIPPickedPointDragStart(),fMinimumZValue);
                    hitContainer.addPicksForPickingType(pickingType,pick,true);
                    processedViews.add(viewID);
                  }
                }
              }
            }
            hashViewIDToPreviousViewSpecificHitListContainer.put(viewID,new ViewSpecificHitListContainer());
          }
        }
      }
    }
  }
 else {
    Set<Integer> remoteRenderedViewIDs=new HashSet<Integer>();
    for (    int viewID : hashViewIDToPreviousViewSpecificHitListContainer.keySet()) {
      AGLView currentView=GeneralManager.get().getViewManager().getGLView(viewID);
      if (currentView != null && currentView.getParentGLCanvas() == parentCanvas) {
        remoteRenderedViewIDs.add(viewID);
      }
    }
    addMouseOutForPicksOfSpecifiedViews(remoteRenderedViewIDs,glMouseListener,pickDIPPoint);
  }
}

Fixed version (ground truth):
/** 
 * This method has to be called in every display step. It is responsible for the ray tracing which does the actual picking. It needs the ID of the calling view and a gl context. It calls the display() method of the calling view, therefore only elements rendered in the display() can be picked.
 * @param glView a reference to the calling view
 * @param gl the GL2 context
 */
public void handlePicking(final AGLView glView,final GL2 gl){
  if (enablePicking == false)   return;
  GLMouseListener glMouseListener=glView.getGLMouseListener();
  PickingMode ePickingMode=PickingMode.CLICKED;
  if (glMouseListener.wasMouseDoubleClicked()) {
    ePickingMode=PickingMode.DOUBLE_CLICKED;
  }
 else   if (glMouseListener.wasMouseDragged()) {
    ePickingMode=PickingMode.DRAGGED;
  }
 else   if (glMouseListener.wasLeftMouseButtonPressed()) {
    ePickingMode=PickingMode.CLICKED;
  }
 else   if (glMouseListener.wasRightMouseButtonPressed()) {
    ePickingMode=PickingMode.RIGHT_CLICKED;
  }
 else   if (glMouseListener.wasMouseMoved()) {
    hashViewIDToIsMouseOverPickingEvent.put(glView.getID(),true);
    ePickingMode=PickingMode.MOUSE_OVER;
  }
 else   if (hashViewIDToIsMouseOverPickingEvent.get(glView.getID()) != null && hashViewIDToIsMouseOverPickingEvent.get(glView.getID()) == true) {
    return;
  }
 else {
    return;
  }
  Point pickRealPoint=glMouseListener.getRAWPickedPoint();
  if (pickRealPoint == null)   return;
  hashViewIDToIsMouseOverPickingEvent.put(glView.getID(),false);
  int PICKING_BUFSIZE=1024;
  int iArPickingBuffer[]=new int[PICKING_BUFSIZE];
  IntBuffer pickingBuffer=Buffers.newDirectIntBuffer(PICKING_BUFSIZE);
  int iHitCount=-1;
  int viewport[]=new int[4];
  gl.glGetIntegerv(GL.GL_VIEWPORT,viewport,0);
  gl.glSelectBuffer(PICKING_BUFSIZE,pickingBuffer);
  gl.glRenderMode(GL2.GL_SELECT);
  gl.glInitNames();
  gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
  gl.glPushMatrix();
  gl.glLoadIdentity();
  GLU glu=new GLU();
  glu.gluPickMatrix(pickRealPoint.x,(viewport[3] - pickRealPoint.y),5.0,5.0,viewport,0);
  float fAspectRatio=(float)(viewport[3] - viewport[1]) / (float)(viewport[2] - viewport[0]);
  ViewFrustum viewFrustum=glView.getViewFrustum();
  viewFrustum.setProjectionMatrix(gl,fAspectRatio);
  Vec2f pickDIPPoint=glMouseListener.getDIPPickedPoint();
  gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
  gl.glPushMatrix();
  gl.glLoadIdentity();
  glView.display(gl);
  gl.glPopMatrix();
  gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
  gl.glPopMatrix();
  gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
  iHitCount=gl.glRenderMode(GL2.GL_RENDER);
  pickingBuffer.get(iArPickingBuffer);
  ArrayList<Integer> iAlPickedObjectId=processHits(iHitCount,iArPickingBuffer);
  IGLCanvas parentCanvas=glView.getParentGLCanvas();
  if (iAlPickedObjectId.size() > 0) {
    processPicks(iAlPickedObjectId,ePickingMode,pickDIPPoint,glMouseListener.getDIPPickedPointDragStart());
    Set<Integer> processedViews=new HashSet<Integer>();
    List<Integer> currentPickedObjectIDs=new ArrayList<>(iAlPickedObjectId);
    for (    int pickingID : iAlPickedObjectId) {
      Pair<Integer,String> pickAssociatedValues=hashPickingIDToViewID.get(pickingID);
      int pickedViewID=pickAssociatedValues.getFirst();
      for (      int viewID : hashViewIDToPreviousViewSpecificHitListContainer.keySet()) {
        if (viewID != pickedViewID && !processedViews.contains(viewID)) {
          AGLView currentView=GeneralManager.get().getViewManager().getGLView(viewID);
          if (currentView != null && currentView.getParentGLCanvas() == parentCanvas) {
            ViewSpecificHitListContainer previousHitContainer=hashViewIDToPreviousViewSpecificHitListContainer.get(viewID);
            if (previousHitContainer != null) {
              for (              String pickingType : previousHitContainer.getPickingTypes()) {
                for (                Pick previousPick : previousHitContainer.getPicksForPickingType(pickingType)) {
                  ViewSpecificHitListContainer hitContainer=hashViewIDToViewSpecificHitListContainer.get(viewID);
                  if (hitContainer == null) {
                    hitContainer=new ViewSpecificHitListContainer();
                    hashViewIDToViewSpecificHitListContainer.put(viewID,hitContainer);
                  }
                  boolean picksExist=false;
                  for (                  String pT : hitContainer.getPickingTypes()) {
                    if (hitContainer.getPicksForPickingType(pT).size() > 0) {
                      picksExist=true;
                      break;
                    }
                  }
                  if (!picksExist && !currentPickedObjectIDs.contains(getPickingID(viewID,pickingType,previousPick.getObjectID()))) {
                    Pick pick=new Pick(previousPick.getObjectID(),PickingMode.MOUSE_OUT,pickDIPPoint,glMouseListener.getDIPPickedPointDragStart(),fMinimumZValue);
                    hitContainer.addPicksForPickingType(pickingType,pick,true);
                    processedViews.add(viewID);
                    hashViewIDToPreviousViewSpecificHitListContainer.put(viewID,new ViewSpecificHitListContainer());
                  }
                }
              }
            }
          }
        }
      }
    }
  }
 else {
    Set<Integer> remoteRenderedViewIDs=new HashSet<Integer>();
    for (    int viewID : hashViewIDToPreviousViewSpecificHitListContainer.keySet()) {
      AGLView currentView=GeneralManager.get().getViewManager().getGLView(viewID);
      if (currentView != null && currentView.getParentGLCanvas() == parentCanvas) {
        remoteRenderedViewIDs.add(viewID);
      }
    }
    addMouseOutForPicksOfSpecifiedViews(remoteRenderedViewIDs,glMouseListener,pickDIPPoint);
  }
}