Program: 46381
Project: 46381
Buggy source:
/** 
 * Picker for mouse events for the Embedded Swing case. To be called by Embedded Swing toolkit createCoordinateHandler. Returns non-null if window is a WindowSwing. If it is a WindowSwing then return the appropriate hit entity and the corresponding pick info.
 * @param awtEvent The event whose entity and pickInfo need to be picked.
 * @return An object of class PickEventReturn, which contains the returnvalues entity and pickDetails.
 */
public InputManager.PickEventReturn pickMouseEventSwing(MouseEvent awtMouseEvent){
  logger.fine("String_Node_Str" + awtMouseEvent);
  destPickInfo=determineDestPickInfo(awtMouseEvent);
  if (destPickInfo == null || destPickInfo.size() <= 0) {
    logger.finest("String_Node_Str");
    logger.finest("String_Node_Str");
    logger.finest("String_Node_Str" + awtMouseEvent);
    swingPickInfos.add(new PickInfoQueueEntry(null,awtMouseEvent));
    return null;
  }
  logger.fine("String_Node_Str" + destPickInfo);
  int eventID=awtMouseEvent.getID();
  if (eventID == MouseEvent.MOUSE_MOVED || eventID == MouseEvent.MOUSE_DRAGGED || eventID == MouseEvent.MOUSE_ENTERED || eventID == MouseEvent.MOUSE_EXITED) {
    generateEnterExitEvents(awtMouseEvent,destPickInfo);
  }
  boolean propagatesToUnder=true;
  PickDetails pickDetails=destPickInfo.get(0);
  logger.fine("String_Node_Str" + pickDetails);
  MouseEvent3D event=(MouseEvent3D)createWonderlandEvent(awtMouseEvent);
  int idx=0;
  while (pickDetails != null && idx < destPickInfo.size() && propagatesToUnder) {
    Entity entity=pickDetailsToEntity(pickDetails);
    logger.fine("String_Node_Str" + entity);
    boolean consumesEvent=false;
    propagatesToUnder=false;
    EventListenerCollection listeners=(EventListenerCollection)entity.getComponent(EventListenerCollection.class);
    if (listeners == null) {
      consumesEvent=false;
      propagatesToUnder=false;
    }
 else {
      event.setPickDetails(pickDetails);
      Iterator<EventListener> it=listeners.iterator();
      while (it.hasNext()) {
        EventListener listener=it.next();
        if (listener.isEnabled()) {
          Event distribEvent=EventDistributor.createEventForEntity(event,entity);
          logger.finest("String_Node_Str");
          logger.finest("String_Node_Str" + listener);
          logger.finest("String_Node_Str" + distribEvent);
          consumesEvent|=listener.consumesEvent(distribEvent);
          propagatesToUnder|=listener.propagatesToUnder(distribEvent);
          logger.finest("String_Node_Str" + consumesEvent);
        }
      }
    }
    logger.finest("String_Node_Str" + isWindowSwingEntity(entity));
    if (consumesEvent && isWindowSwingEntity(entity)) {
      logger.fine("String_Node_Str");
      return new InputManager.PickEventReturn(entity,pickDetails);
    }
    if (propagatesToUnder) {
      idx++;
      if (idx < destPickInfo.size()) {
        pickDetails=destPickInfo.get(idx);
      }
 else {
        pickDetails=null;
      }
    }
  }
  logger.finest("String_Node_Str");
  logger.finest("String_Node_Str" + awtMouseEvent);
  logger.finest("String_Node_Str" + destPickInfo);
  swingPickInfos.add(new PickInfoQueueEntry(destPickInfo,awtMouseEvent));
  return null;
}

Fixed version (ground truth):
/** 
 * Picker for mouse events for the Embedded Swing case. To be called by Embedded Swing toolkit createCoordinateHandler. Returns non-null if window is a WindowSwing. If it is a WindowSwing then return the appropriate hit entity and the corresponding pick info.
 * @param awtEvent The event whose entity and pickInfo need to be picked.
 * @return An object of class PickEventReturn, which contains the returnvalues entity and pickDetails.
 */
public InputManager.PickEventReturn pickMouseEventSwing(MouseEvent awtMouseEvent){
  logger.fine("String_Node_Str" + awtMouseEvent);
  destPickInfo=determineDestPickInfo(awtMouseEvent);
  int eventID=awtMouseEvent.getID();
  if (eventID == MouseEvent.MOUSE_MOVED || eventID == MouseEvent.MOUSE_DRAGGED || eventID == MouseEvent.MOUSE_ENTERED || eventID == MouseEvent.MOUSE_EXITED) {
    generateEnterExitEvents(awtMouseEvent,destPickInfo);
  }
  if (destPickInfo == null || destPickInfo.size() <= 0) {
    logger.finest("String_Node_Str");
    logger.finest("String_Node_Str");
    logger.finest("String_Node_Str" + awtMouseEvent);
    swingPickInfos.add(new PickInfoQueueEntry(null,awtMouseEvent));
    return null;
  }
  logger.fine("String_Node_Str" + destPickInfo);
  boolean propagatesToUnder=true;
  PickDetails pickDetails=destPickInfo.get(0);
  logger.fine("String_Node_Str" + pickDetails);
  MouseEvent3D event=(MouseEvent3D)createWonderlandEvent(awtMouseEvent);
  int idx=0;
  while (pickDetails != null && idx < destPickInfo.size() && propagatesToUnder) {
    Entity entity=pickDetailsToEntity(pickDetails);
    logger.fine("String_Node_Str" + entity);
    boolean consumesEvent=false;
    propagatesToUnder=false;
    EventListenerCollection listeners=(EventListenerCollection)entity.getComponent(EventListenerCollection.class);
    if (listeners == null) {
      consumesEvent=false;
      propagatesToUnder=false;
    }
 else {
      event.setPickDetails(pickDetails);
      Iterator<EventListener> it=listeners.iterator();
      while (it.hasNext()) {
        EventListener listener=it.next();
        if (listener.isEnabled()) {
          Event distribEvent=EventDistributor.createEventForEntity(event,entity);
          logger.finest("String_Node_Str");
          logger.finest("String_Node_Str" + listener);
          logger.finest("String_Node_Str" + distribEvent);
          consumesEvent|=listener.consumesEvent(distribEvent);
          propagatesToUnder|=listener.propagatesToUnder(distribEvent);
          logger.finest("String_Node_Str" + consumesEvent);
        }
      }
    }
    logger.finest("String_Node_Str" + isWindowSwingEntity(entity));
    if (consumesEvent && isWindowSwingEntity(entity)) {
      logger.fine("String_Node_Str");
      return new InputManager.PickEventReturn(entity,pickDetails);
    }
    if (propagatesToUnder) {
      idx++;
      if (idx < destPickInfo.size()) {
        pickDetails=destPickInfo.get(idx);
      }
 else {
        pickDetails=null;
      }
    }
  }
  logger.finest("String_Node_Str");
  logger.finest("String_Node_Str" + awtMouseEvent);
  logger.finest("String_Node_Str" + destPickInfo);
  swingPickInfos.add(new PickInfoQueueEntry(destPickInfo,awtMouseEvent));
  return null;
}