Program: 59054
Project: 59054
Buggy source:
/** 
 * TODO: Documentation
 * @param uniqueManagedObject
 * @param gl
 * @param pickingTriggerMouseAdapter
 * @param bIsMaster
 */
public void handlePicking(final int iViewID,final GL gl,final boolean bIsMaster){
  if (bEnablePicking == false)   return;
  AGLEventListener canvasUser=(GeneralManager.get().getViewGLCanvasManager().getGLEventListener(iViewID));
  PickingJoglMouseListener pickingTriggerMouseAdapter=canvasUser.getParentGLCanvas().getJoglMouseListener();
  Point pickPoint=null;
  EPickingMode ePickingMode=EPickingMode.CLICKED;
  if (pickingTriggerMouseAdapter.wasLeftMouseButtonPressed()) {
    pickPoint=pickingTriggerMouseAdapter.getPickedPoint();
    ePickingMode=EPickingMode.CLICKED;
  }
 else   if (pickingTriggerMouseAdapter.wasMouseDragged()) {
    pickPoint=pickingTriggerMouseAdapter.getPickedPoint();
    ePickingMode=EPickingMode.DRAGGED;
  }
 else   if (pickingTriggerMouseAdapter.wasMouseMoved()) {
    hashViewIDToLastMouseMovedTimeStamp.put(iViewID,System.nanoTime());
    hashViewIDToIsMouseOverPickingEvent.put(iViewID,true);
  }
 else   if (hashViewIDToIsMouseOverPickingEvent.get(iViewID) != null && hashViewIDToLastMouseMovedTimeStamp.get(iViewID) != null && hashViewIDToIsMouseOverPickingEvent.get(iViewID) == true && System.nanoTime() - hashViewIDToLastMouseMovedTimeStamp.get(iViewID) >= 0) {
    pickPoint=pickingTriggerMouseAdapter.getPickedPoint();
    hashViewIDToLastMouseMovedTimeStamp.put(iViewID,System.nanoTime());
    ePickingMode=EPickingMode.MOUSE_OVER;
  }
  if (pickPoint == null) {
    return;
  }
  hashViewIDToIsMouseOverPickingEvent.put(iViewID,false);
  int PICKING_BUFSIZE=1024;
  int iArPickingBuffer[]=new int[PICKING_BUFSIZE];
  IntBuffer pickingBuffer=BufferUtil.newIntBuffer(PICKING_BUFSIZE);
  int iHitCount=-1;
  int viewport[]=new int[4];
  gl.glGetIntegerv(GL.GL_VIEWPORT,viewport,0);
  gl.glSelectBuffer(PICKING_BUFSIZE,pickingBuffer);
  gl.glRenderMode(GL.GL_SELECT);
  gl.glInitNames();
  gl.glMatrixMode(GL.GL_PROJECTION);
  gl.glPushMatrix();
  gl.glLoadIdentity();
  GLU glu=new GLU();
  glu.gluPickMatrix(pickPoint.x,(viewport[3] - pickPoint.y),5.0,5.0,viewport,0);
  float fAspectRatio=(viewport[3] - viewport[1]) / (viewport[2] - viewport[0]);
  IViewFrustum viewFrustum=canvasUser.getViewFrustum();
  viewFrustum.setProjectionMatrix(gl,fAspectRatio);
  gl.glMatrixMode(GL.GL_MODELVIEW);
  Point tmpPickPoint=(Point)pickPoint.clone();
  pickPoint=null;
  canvasUser.display(gl);
  gl.glMatrixMode(GL.GL_PROJECTION);
  gl.glPopMatrix();
  gl.glMatrixMode(GL.GL_MODELVIEW);
  iHitCount=gl.glRenderMode(GL.GL_RENDER);
  pickingBuffer.get(iArPickingBuffer);
  ArrayList<Integer> iAlPickedObjectId=processHits(iHitCount,iArPickingBuffer);
  if (iAlPickedObjectId.size() > 0) {
    processPicks(iAlPickedObjectId,iViewID,ePickingMode,bIsMaster,tmpPickPoint,pickingTriggerMouseAdapter.getPickedPointDragStart());
  }
}

Fixed version (ground truth):
/** 
 * TODO: Documentation
 * @param uniqueManagedObject
 * @param gl
 * @param pickingTriggerMouseAdapter
 * @param bIsMaster
 */
public void handlePicking(final int iViewID,final GL gl,final boolean bIsMaster){
  if (bEnablePicking == false)   return;
  AGLEventListener canvasUser=(GeneralManager.get().getViewGLCanvasManager().getGLEventListener(iViewID));
  PickingJoglMouseListener pickingTriggerMouseAdapter=canvasUser.getParentGLCanvas().getJoglMouseListener();
  Point pickPoint=null;
  EPickingMode ePickingMode=EPickingMode.CLICKED;
  if (pickingTriggerMouseAdapter.wasLeftMouseButtonPressed()) {
    pickPoint=pickingTriggerMouseAdapter.getPickedPoint();
    ePickingMode=EPickingMode.CLICKED;
  }
 else   if (pickingTriggerMouseAdapter.wasMouseDragged()) {
    pickPoint=pickingTriggerMouseAdapter.getPickedPoint();
    ePickingMode=EPickingMode.DRAGGED;
  }
 else   if (pickingTriggerMouseAdapter.wasMouseMoved()) {
    hashViewIDToLastMouseMovedTimeStamp.put(iViewID,System.nanoTime());
    hashViewIDToIsMouseOverPickingEvent.put(iViewID,true);
  }
 else   if (hashViewIDToIsMouseOverPickingEvent.get(iViewID) != null && hashViewIDToLastMouseMovedTimeStamp.get(iViewID) != null && hashViewIDToIsMouseOverPickingEvent.get(iViewID) == true && System.nanoTime() - hashViewIDToLastMouseMovedTimeStamp.get(iViewID) >= 0) {
    pickPoint=pickingTriggerMouseAdapter.getPickedPoint();
    hashViewIDToLastMouseMovedTimeStamp.put(iViewID,System.nanoTime());
    ePickingMode=EPickingMode.MOUSE_OVER;
  }
  if (pickPoint == null) {
    return;
  }
  hashViewIDToIsMouseOverPickingEvent.put(iViewID,false);
  int PICKING_BUFSIZE=1024;
  int iArPickingBuffer[]=new int[PICKING_BUFSIZE];
  IntBuffer pickingBuffer=BufferUtil.newIntBuffer(PICKING_BUFSIZE);
  int iHitCount=-1;
  int viewport[]=new int[4];
  gl.glGetIntegerv(GL.GL_VIEWPORT,viewport,0);
  gl.glSelectBuffer(PICKING_BUFSIZE,pickingBuffer);
  gl.glRenderMode(GL.GL_SELECT);
  gl.glInitNames();
  gl.glMatrixMode(GL.GL_PROJECTION);
  gl.glPushMatrix();
  gl.glLoadIdentity();
  GLU glu=new GLU();
  glu.gluPickMatrix(pickPoint.x,(viewport[3] - pickPoint.y),5.0,5.0,viewport,0);
  float fAspectRatio=(float)(viewport[3] - viewport[1]) / (float)(viewport[2] - viewport[0]);
  IViewFrustum viewFrustum=canvasUser.getViewFrustum();
  viewFrustum.setProjectionMatrix(gl,fAspectRatio);
  gl.glMatrixMode(GL.GL_MODELVIEW);
  Point tmpPickPoint=(Point)pickPoint.clone();
  pickPoint=null;
  canvasUser.display(gl);
  gl.glMatrixMode(GL.GL_PROJECTION);
  gl.glPopMatrix();
  gl.glMatrixMode(GL.GL_MODELVIEW);
  iHitCount=gl.glRenderMode(GL.GL_RENDER);
  pickingBuffer.get(iArPickingBuffer);
  ArrayList<Integer> iAlPickedObjectId=processHits(iHitCount,iArPickingBuffer);
  if (iAlPickedObjectId.size() > 0) {
    processPicks(iAlPickedObjectId,iViewID,ePickingMode,bIsMaster,tmpPickPoint,pickingTriggerMouseAdapter.getPickedPointDragStart());
  }
}