Program: 95861
Project: 95861
Buggy source:
/** 
 * Send a message through this communicator and expect a response of type command. ICommand.request will be called at the other site. If a response was received the corresponding data will be set to the command object via setData(). If the response was received during the given timeout, command.response will be called. Otherwise command.timeout will be called. This method will not block.
 * @param message -the Message to send, must not be null otherwise an CommunicationException is thrown.
 * @param command -the expected command, must not be null or a CommunicationException is thrown. If the command arrives in good time, the method execute() of the given instance will be called. If the commands arrives to late timeout() will be called.
 * @param timeout -max milliseconds to wait for a response. Only values greater  than zero are valid. For values less or equals to zero the configured default timeout will be used. If the timeout expires, the method timeout() in command will be called.
 * @throws CommunicationException if any error/exception occurs. A CommnunicationException is also thrown if this communicator is not connected, e.g. run() was not called, or exceptions at creation time were ignored
 */
public void request(Message message,ICommand command,int timeout) throws CommunicationException {
  checkConnectionState("String_Node_Str");
  if (message == null) {
    log.debug("String_Node_Str" + "String_Node_Str");
    throw new CommunicationException("String_Node_Str",MessageIDs.E_MESSAGE_NOT_TO_REQUEST);
  }
  if (command == null) {
    log.debug("String_Node_Str" + "String_Node_Str");
    throw new CommunicationException("String_Node_Str",MessageIDs.E_NO_RECEIVING_COMMAND);
  }
  int timeoutToUse=m_requestTimeout;
  if (timeout <= 0) {
    log.debug("String_Node_Str" + "String_Node_Str");
  }
 else {
    timeoutToUse=timeout;
  }
  MessageIdentifier messageIdentifier=new MessageIdentifier(m_connection.getNextSequenceNumber());
  try {
    message.setMessageId(messageIdentifier);
    String messageToSend=m_serializer.serialize(message);
    AwaitingCommand awaitingCommand=new AwaitingCommand(command,timeoutToUse);
synchronized (m_awaitingCommands) {
      m_awaitingCommands.put(messageIdentifier,awaitingCommand);
    }
    m_connection.send(new MessageHeader(MessageHeader.REQUEST,message),messageToSend);
    awaitingCommand.start();
  }
 catch (  SerialisationException se) {
    log.error(se.getLocalizedMessage(),se);
    throw new CommunicationException("String_Node_Str" + se.getMessage(),MessageIDs.E_MESSAGE_NOT_TO_REQUEST);
  }
catch (  IOException ioe) {
    log.error(ioe.getLocalizedMessage(),ioe);
synchronized (m_awaitingCommands) {
      m_awaitingCommands.remove(messageIdentifier);
    }
    throw new CommunicationException("String_Node_Str" + ioe.getMessage(),MessageIDs.E_MESSAGE_REQUEST);
  }
catch (  IllegalArgumentException iae) {
    log.error(iae.getLocalizedMessage(),iae);
synchronized (m_awaitingCommands) {
      m_awaitingCommands.remove(messageIdentifier);
    }
    log.debug(iae.getLocalizedMessage(),iae);
    throw new CommunicationException("String_Node_Str",MessageIDs.E_MESSAGE_NOT_TO_REQUEST);
  }
}

Fixed version (ground truth):
/** 
 * Send a message through this communicator and expect a response of type command. ICommand.request will be called at the other site. If a response was received the corresponding data will be set to the command object via setData(). If the response was received during the given timeout, command.response will be called. Otherwise command.timeout will be called. This method will not block.
 * @param message -the Message to send, must not be null otherwise an CommunicationException is thrown.
 * @param command -the expected command, must not be null or a CommunicationException is thrown. If the command arrives in good time, the method execute() of the given instance will be called. If the commands arrives to late timeout() will be called.
 * @param timeout -max milliseconds to wait for a response. Only values greater  than zero are valid. For values less or equals to zero the configured default timeout will be used. If the timeout expires, the method timeout() in command will be called.
 * @throws CommunicationException if any error/exception occurs. A CommnunicationException is also thrown if this communicator is not connected, e.g. run() was not called, or exceptions at creation time were ignored
 */
public void request(Message message,ICommand command,int timeout) throws CommunicationException {
  checkConnectionState("String_Node_Str");
  if (message == null) {
    log.debug("String_Node_Str" + "String_Node_Str");
    throw new CommunicationException("String_Node_Str",MessageIDs.E_MESSAGE_NOT_TO_REQUEST);
  }
  if (command == null) {
    log.debug("String_Node_Str" + "String_Node_Str");
    throw new CommunicationException("String_Node_Str",MessageIDs.E_NO_RECEIVING_COMMAND);
  }
  int timeoutToUse=DEFAULT_REQUEST_TIMEOUT;
  if (timeout <= 0) {
    log.debug("String_Node_Str" + "String_Node_Str");
  }
 else {
    timeoutToUse=timeout;
  }
  MessageIdentifier messageIdentifier=new MessageIdentifier(m_connection.getNextSequenceNumber());
  try {
    message.setMessageId(messageIdentifier);
    String messageToSend=m_serializer.serialize(message);
    AwaitingCommand awaitingCommand=new AwaitingCommand(command,timeoutToUse);
synchronized (m_awaitingCommands) {
      m_awaitingCommands.put(messageIdentifier,awaitingCommand);
    }
    m_connection.send(new MessageHeader(MessageHeader.REQUEST,message),messageToSend);
    awaitingCommand.start();
  }
 catch (  SerialisationException se) {
    log.error(se.getLocalizedMessage(),se);
    throw new CommunicationException("String_Node_Str" + se.getMessage(),MessageIDs.E_MESSAGE_NOT_TO_REQUEST);
  }
catch (  IOException ioe) {
    log.error(ioe.getLocalizedMessage(),ioe);
synchronized (m_awaitingCommands) {
      m_awaitingCommands.remove(messageIdentifier);
    }
    throw new CommunicationException("String_Node_Str" + ioe.getMessage(),MessageIDs.E_MESSAGE_REQUEST);
  }
catch (  IllegalArgumentException iae) {
    log.error(iae.getLocalizedMessage(),iae);
synchronized (m_awaitingCommands) {
      m_awaitingCommands.remove(messageIdentifier);
    }
    log.debug(iae.getLocalizedMessage(),iae);
    throw new CommunicationException("String_Node_Str",MessageIDs.E_MESSAGE_NOT_TO_REQUEST);
  }
}