Program: 46317
Project: 46317
Buggy source:
/** 
 * Performs a pick on the scene graph and determine the actual destination pick info  taking into account button click threshold and mouse button grabbing. Returns the destination pick info in the global member destPickInfo.
 * @param e The mouse event.
 * @return The destination pick info.
 */
protected DetermineDestPickInfoReturn determineDestPickInfo(MouseEvent e){
  boolean deactivateGrab=false;
  PickInfo swingHitPickInfo=null;
  if (swingPickInfos.peek() != null) {
    try {
      PickInfoQueueEntry entry=swingPickInfos.take();
      if (e.getID() == entry.mouseEvent.getID() && e.getX() == entry.mouseEvent.getX() && e.getY() == entry.mouseEvent.getY()) {
        swingHitPickInfo=entry.hitPickInfo;
      }
 else {
        logger.warning("String_Node_Str");
        logger.warning("String_Node_Str" + e);
        logger.warning("String_Node_Str" + entry.mouseEvent);
      }
    }
 catch (    InterruptedException ex) {
    }
  }
  if (e.getID() == MouseEvent.MOUSE_PRESSED) {
    buttonLastX=e.getX();
    buttonLastY=e.getY();
  }
 else   if (e.getID() == MouseEvent.MOUSE_CLICKED) {
    if (!buttonWithinClickThreshold(e.getX(),e.getY())) {
      return null;
    }
  }
  if (e.getID() == MouseEvent.MOUSE_CLICKED) {
    return new DetermineDestPickInfoReturn(lastButtonReleasedPickInfo,lastButtonReleasedPickInfo);
  }
  PickInfo hitPickInfo;
  if (swingHitPickInfo == null) {
    hitPickInfo=pickEventScreenPos(e.getX(),e.getY());
    logger.finest("String_Node_Str" + hitPickInfo);
    if (hitPickInfo != null) {
      logger.finest("String_Node_Str" + hitPickInfo.size());
    }
  }
 else {
    hitPickInfo=swingHitPickInfo;
  }
  if (!grabIsActive && (hitPickInfo == null || hitPickInfo.size() <= 0)) {
    if (e.getID() == MouseEvent.MOUSE_RELEASED) {
      lastButtonReleasedPickInfo=null;
    }
    return null;
  }
  GrabChangeType grabChange=GrabChangeType.GRAB_NO_CHANGE;
  int eventID=e.getID();
  if (eventID == MouseEvent.MOUSE_PRESSED || eventID == MouseEvent.MOUSE_RELEASED) {
    grabChange=evaluateButtonGrabStateChange(eventID,e);
    if (grabChange == GrabChangeType.GRAB_ACTIVATE) {
      grabIsActive=true;
      grabPickInfo=hitPickInfo;
      logger.finest("String_Node_Str" + grabPickInfo);
      if (grabPickInfo != null) {
        logger.finest("String_Node_Str" + grabPickInfo.size());
        if (grabPickInfo.size() > 0) {
          PickDetails pd=grabPickInfo.get(0);
          logger.finest("String_Node_Str" + pd);
          if (pd != null) {
            logPickDetailsEntity(pd);
            CollisionComponent cc=pd.getCollisionComponent();
            logger.finest("String_Node_Str" + cc);
            if (cc != null) {
              logger.finest("String_Node_Str" + cc.getEntity());
            }
          }
        }
      }
    }
  }
  PickInfo destPickInfo;
  logger.finest("String_Node_Str" + grabIsActive);
  if (grabIsActive) {
    destPickInfo=grabPickInfo;
    logger.finest("String_Node_Str" + grabPickInfo);
  }
 else {
    destPickInfo=hitPickInfo;
  }
  logger.finest("String_Node_Str" + destPickInfo);
  if (grabChange == GrabChangeType.GRAB_DEACTIVATE) {
    grabIsActive=false;
    grabPickInfo=null;
  }
  if (e.getID() == MouseEvent.MOUSE_RELEASED) {
    lastButtonReleasedPickInfo=destPickInfo;
  }
  logger.fine("String_Node_Str" + e);
  logPickInfo("String_Node_Str",destPickInfo);
  logPickInfo("String_Node_Str",hitPickInfo);
  return new DetermineDestPickInfoReturn(destPickInfo,hitPickInfo);
}

Fixed version (ground truth):
/** 
 * Performs a pick on the scene graph and determine the actual destination pick info  taking into account button click threshold and mouse button grabbing. Returns the destination pick info in the global member destPickInfo.
 * @param e The mouse event.
 * @return The destination pick info.
 */
protected DetermineDestPickInfoReturn determineDestPickInfo(MouseEvent e){
  boolean deactivateGrab=false;
  PickInfo swingHitPickInfo=null;
  if (swingPickInfos.peek() != null) {
    try {
      PickInfoQueueEntry entry=swingPickInfos.take();
      if (e.getID() == entry.mouseEvent.getID() && e.getX() == entry.mouseEvent.getX() && e.getY() == entry.mouseEvent.getY()) {
        swingHitPickInfo=entry.hitPickInfo;
      }
 else {
        logger.warning("String_Node_Str");
        logger.warning("String_Node_Str" + e);
        logger.warning("String_Node_Str" + entry.mouseEvent);
      }
    }
 catch (    InterruptedException ex) {
    }
  }
  if (e.getID() == MouseEvent.MOUSE_PRESSED) {
    buttonLastX=e.getX();
    buttonLastY=e.getY();
  }
 else   if (e.getID() == MouseEvent.MOUSE_CLICKED) {
    if (!buttonWithinClickThreshold(e.getX(),e.getY())) {
      return null;
    }
  }
  if (e.getID() == MouseEvent.MOUSE_CLICKED) {
    return new DetermineDestPickInfoReturn(lastButtonReleasedPickInfo,lastButtonReleasedPickInfo);
  }
  PickInfo hitPickInfo;
  if (swingHitPickInfo == null) {
    hitPickInfo=pickEventScreenPos(e.getX(),e.getY());
    logger.finest("String_Node_Str" + hitPickInfo);
    if (hitPickInfo != null) {
      logger.finest("String_Node_Str" + hitPickInfo.size());
    }
  }
 else {
    hitPickInfo=swingHitPickInfo;
  }
  GrabChangeType grabChange=GrabChangeType.GRAB_NO_CHANGE;
  int eventID=e.getID();
  if (eventID == MouseEvent.MOUSE_PRESSED || eventID == MouseEvent.MOUSE_RELEASED) {
    grabChange=evaluateButtonGrabStateChange(eventID,e);
    if (grabChange == GrabChangeType.GRAB_ACTIVATE) {
      grabIsActive=true;
      grabPickInfo=hitPickInfo;
      logger.finest("String_Node_Str" + grabPickInfo);
      if (grabPickInfo != null) {
        logger.finest("String_Node_Str" + grabPickInfo.size());
        if (grabPickInfo.size() > 0) {
          PickDetails pd=grabPickInfo.get(0);
          logger.finest("String_Node_Str" + pd);
          if (pd != null) {
            logPickDetailsEntity(pd);
            CollisionComponent cc=pd.getCollisionComponent();
            logger.finest("String_Node_Str" + cc);
            if (cc != null) {
              logger.finest("String_Node_Str" + cc.getEntity());
            }
          }
        }
      }
    }
  }
  PickInfo destPickInfo;
  logger.finest("String_Node_Str" + grabIsActive);
  if (grabIsActive) {
    destPickInfo=grabPickInfo;
    logger.finest("String_Node_Str" + grabPickInfo);
  }
 else {
    destPickInfo=hitPickInfo;
  }
  logger.finest("String_Node_Str" + destPickInfo);
  if (grabChange == GrabChangeType.GRAB_DEACTIVATE) {
    grabIsActive=false;
    grabPickInfo=null;
  }
  if (e.getID() == MouseEvent.MOUSE_RELEASED) {
    lastButtonReleasedPickInfo=destPickInfo;
  }
  logger.fine("String_Node_Str" + e);
  logPickInfo("String_Node_Str",destPickInfo);
  logPickInfo("String_Node_Str",hitPickInfo);
  return new DetermineDestPickInfoReturn(destPickInfo,hitPickInfo);
}