Program: 46343
Project: 46343
Buggy source:
/** 
 * Process a message from a client. Sync message: send all accumulated messages back to the client (the sender). All other messages: broadcast to <bold>all</bold> cells (including the sender!)
 * @param clientSender The sender object for the client who sent the message.
 * @param clientSession The session for the client who sent the message.
 * @param message The message which was received.
 * @param commComponent The communications component that received the message.
 */
public void receivedMessage(WonderlandClientSender clientSender,ClientSession clientSession,CellMessage message){
  WhiteboardCompoundCellMessage cmsg=(WhiteboardCompoundCellMessage)message;
  logger.fine("String_Node_Str" + cmsg);
  WhiteboardComponentMO commComponent=commComponentRef.getForUpdate();
  if (cmsg.getAction() == Action.REQUEST_SYNC) {
    logger.fine("String_Node_Str" + messages.size() + "String_Node_Str");
    Iterator<WhiteboardCompoundCellMessage> iter=messages.iterator();
    while (iter.hasNext()) {
      WhiteboardCompoundCellMessage msg=iter.next();
      clientSender.send(clientSession,msg);
    }
  }
 else {
    WhiteboardCompoundCellMessage msg=new WhiteboardCompoundCellMessage(cmsg.getClientID(),cmsg.getCellID(),cmsg.getAction());
switch (cmsg.getAction()) {
case SET_TOOL:
      msg.setTool(cmsg.getTool());
    break;
case SET_COLOR:
  msg.setColor(cmsg.getColor());
break;
case MOVE_TO:
case DRAG_TO:
msg.setPositions(cmsg.getPositions());
break;
case REQUEST_SYNC:
break;
case EXECUTE_COMMAND:
msg.setCommand(cmsg.getCommand());
break;
}
if (cmsg.getAction() == Action.EXECUTE_COMMAND) {
if (cmsg.getCommand() == Command.ERASE) {
logger.fine("String_Node_Str");
messages.clear();
}
}
 else {
if (cmsg.getAction() != Action.MOVE_TO) {
if ((lastMessage != null) && lastMessage.getAction() == Action.MOVE_TO) {
messages.add(lastMessage);
}
cmsg.setClientID(null);
messages.add(cmsg);
}
}
lastMessage=cmsg;
commComponent.sendAllClients(msg);
}
}

Fixed version (ground truth):
/** 
 * Process a message from a client. Sync message: send all accumulated messages back to the client (the sender). All other messages: broadcast to <bold>all</bold> cells (including the sender!)
 * @param clientSender The sender object for the client who sent the message.
 * @param clientSession The session for the client who sent the message.
 * @param message The message which was received.
 * @param commComponent The communications component that received the message.
 */
public void receivedMessage(WonderlandClientSender clientSender,ClientSession clientSession,CellMessage message){
  WhiteboardCompoundCellMessage cmsg=(WhiteboardCompoundCellMessage)message;
  logger.fine("String_Node_Str" + cmsg);
  WhiteboardComponentMO commComponent=commComponentRef.getForUpdate();
  if (cmsg.getAction() == Action.REQUEST_SYNC) {
    logger.fine("String_Node_Str" + messages.size() + "String_Node_Str");
    Iterator<WhiteboardCompoundCellMessage> iter=messages.iterator();
    while (iter.hasNext()) {
      WhiteboardCompoundCellMessage msg=iter.next();
      clientSender.send(clientSession,msg);
    }
  }
 else {
    WhiteboardCompoundCellMessage msg=new WhiteboardCompoundCellMessage(cmsg.getClientID(),cmsg.getCellID(),cmsg.getAction());
switch (cmsg.getAction()) {
case SET_TOOL:
      msg.setTool(cmsg.getTool());
    break;
case SET_COLOR:
  msg.setColor(cmsg.getColor());
break;
case MOVE_TO:
case DRAG_TO:
msg.setPositions(cmsg.getPositions());
break;
case REQUEST_SYNC:
break;
case EXECUTE_COMMAND:
msg.setCommand(cmsg.getCommand());
break;
}
if (cmsg.getAction() == Action.EXECUTE_COMMAND) {
if (cmsg.getCommand() == Command.ERASE) {
logger.fine("String_Node_Str");
messages.clear();
}
}
 else {
if (cmsg.getAction() != Action.MOVE_TO) {
if ((lastMessage != null) && lastMessage.getAction() == Action.MOVE_TO) {
messages.add(lastMessage);
}
cmsg.setClientID(null);
messages.add(cmsg);
}
}
lastMessage=cmsg;
BigInteger sessionId=AppContext.getDataManager().createReference(clientSession).getId();
commComponent.sendAllClients(sessionId,msg);
}
}