Program: 46403
Project: 46403
Buggy source:
/** 
 * Create a new instance of WhiteboardWindow.
 * @param app The whiteboard app which owns the window.
 * @param width The width of the window (in pixels).
 * @param height The height of the window (in pixels).
 * @param topLevel Whether the window is top-level (e.g. is decorated) with a frame.
 * @param pixelScale The size of the window pixels.
 * @param commComponent The communications component for communicating with the server.
 */
public WhiteboardWindow(final App app,int width,int height,boolean topLevel,Vector2f pixelScale,final WhiteboardComponent commComponent) throws InstantiationException {
  super(app,width,height,topLevel,pixelScale,new WhiteboardDrawingSurface(width,height));
  setTitle("String_Node_Str");
  wbSurface=(WhiteboardDrawingSurface)getSurface();
  addMouseMotionListener(new MouseMotionListener(){
    public void mouseDragged(    MouseEvent e){
      dragTo(e.getPoint());
      WhiteboardCellMessage msg=new WhiteboardCellMessage(getClientID(app),app.getCell().getCellID(),WhiteboardAction.DRAG_TO,e.getPoint());
      commComponent.sendMessage(msg);
    }
    public void mouseMoved(    MouseEvent e){
      moveTo(e.getPoint());
      WhiteboardCellMessage msg=new WhiteboardCellMessage(getClientID(app),app.getCell().getCellID(),WhiteboardAction.MOVE_TO,e.getPoint());
      commComponent.sendMessage(msg);
    }
  }
);
  addMouseListener(new MouseListener(){
    public void mouseClicked(    MouseEvent e){
      selectPen(e.getPoint());
      WhiteboardCellMessage msg=null;
switch (wbSurface.getActionType()) {
case COLOR:
        logger.info("String_Node_Str" + wbSurface.getPenColor());
      msg=new WhiteboardCellMessage(getClientID(app),app.getCell().getCellID(),WhiteboardAction.SET_COLOR,wbSurface.getPenColor());
    break;
case TOOL:
  logger.info("String_Node_Str" + wbSurface.getTool());
msg=new WhiteboardCellMessage(getClientID(app),app.getCell().getCellID(),WhiteboardAction.SET_TOOL,wbSurface.getTool());
break;
case COMMAND:
logger.info("String_Node_Str" + wbSurface.getCommand());
msg=new WhiteboardCellMessage(getClientID(app),app.getCell().getCellID(),WhiteboardAction.EXECUTE_COMMAND,wbSurface.getCommand());
break;
}
if (msg != null) {
commComponent.sendMessage(msg);
}
}
public void mousePressed(MouseEvent e){
}
public void mouseReleased(MouseEvent e){
}
public void mouseEntered(MouseEvent e){
}
public void mouseExited(MouseEvent e){
}
}
);
}

Fixed version (ground truth):
/** 
 * Create a new instance of WhiteboardWindow.
 * @param app The whiteboard app which owns the window.
 * @param width The width of the window (in pixels).
 * @param height The height of the window (in pixels).
 * @param topLevel Whether the window is top-level (e.g. is decorated) with a frame.
 * @param pixelScale The size of the window pixels.
 * @param commComponent The communications component for communicating with the server.
 */
public WhiteboardWindow(final App app,int width,int height,boolean topLevel,Vector2f pixelScale,final WhiteboardComponent commComponent) throws InstantiationException {
  super(app,width,height,topLevel,pixelScale,new WhiteboardDrawingSurface(width,height));
  initializeSurface();
  setTitle("String_Node_Str");
  wbSurface=(WhiteboardDrawingSurface)getSurface();
  addMouseMotionListener(new MouseMotionListener(){
    public void mouseDragged(    MouseEvent e){
      dragTo(e.getPoint());
      WhiteboardCellMessage msg=new WhiteboardCellMessage(getClientID(app),app.getCell().getCellID(),WhiteboardAction.DRAG_TO,e.getPoint());
      commComponent.sendMessage(msg);
    }
    public void mouseMoved(    MouseEvent e){
      moveTo(e.getPoint());
      WhiteboardCellMessage msg=new WhiteboardCellMessage(getClientID(app),app.getCell().getCellID(),WhiteboardAction.MOVE_TO,e.getPoint());
      commComponent.sendMessage(msg);
    }
  }
);
  addMouseListener(new MouseListener(){
    public void mouseClicked(    MouseEvent e){
      selectPen(e.getPoint());
      WhiteboardCellMessage msg=null;
switch (wbSurface.getActionType()) {
case COLOR:
        logger.info("String_Node_Str" + wbSurface.getPenColor());
      msg=new WhiteboardCellMessage(getClientID(app),app.getCell().getCellID(),WhiteboardAction.SET_COLOR,wbSurface.getPenColor());
    break;
case TOOL:
  logger.info("String_Node_Str" + wbSurface.getTool());
msg=new WhiteboardCellMessage(getClientID(app),app.getCell().getCellID(),WhiteboardAction.SET_TOOL,wbSurface.getTool());
break;
case COMMAND:
logger.info("String_Node_Str" + wbSurface.getCommand());
msg=new WhiteboardCellMessage(getClientID(app),app.getCell().getCellID(),WhiteboardAction.EXECUTE_COMMAND,wbSurface.getCommand());
break;
}
if (msg != null) {
commComponent.sendMessage(msg);
}
}
public void mousePressed(MouseEvent e){
}
public void mouseReleased(MouseEvent e){
}
public void mouseEntered(MouseEvent e){
}
public void mouseExited(MouseEvent e){
}
}
);
}