Program: 95841
Project: 95841
Buggy source:
/** 
 * A synchronized method for sending messages. If an IO error occurs, the error handlers will be notified with sendFailed, shutDown AND an IOException will be thrown. In case of a serialization error the error handler will be notified with sendFailed(). The header is filled with the message length 
 * @param header - the header for the message, must not be null
 * @param message - the message to send, must not be null
 * @throws IOException - if the message could not send due to an IOException
 * @throws IllegalArgumentException - if the given message is null
 */
public synchronized void send(MessageHeader header,String message) throws IOException, IllegalArgumentException {
  Validate.notNull(header,"String_Node_Str");
  Validate.notNull(message,"String_Node_Str");
  MessageWriter writer=null;
  try {
    header.setMessageLength(message.length());
    String serializedHeader=m_headerSerializer.serialize(header);
    writer=new MessageWriter(new OutputStreamWriter(m_outputStream,IO_STREAM_ENCODING));
    writer.write(MessageHeader.HEADER_START);
    writer.write(StringConstants.EMPTY + serializedHeader.length());
    writer.newLine();
    writer.write(serializedHeader);
    writer.write(message);
    writer.flush();
    if (getLogger().isInfoEnabled()) {
      getLogger().info("String_Node_Str" + m_socket.getRemoteSocketAddress() + "String_Node_Str"+ serializedHeader);
    }
    if (getLogger().isDebugEnabled()) {
      getLogger().debug("String_Node_Str" + message);
    }
  }
 catch (  IOException ioe) {
    getLogger().error("String_Node_Str",ioe);
    fireSendFailed(message,header);
    fireShutDown();
    throw ioe;
  }
catch (  SerialisationException se) {
    getLogger().error("String_Node_Str" + header.toString() + "String_Node_Str",se);
    fireSendFailed(message,header);
  }
 finally {
    if (writer != null) {
      writer.close();
    }
  }
}

Fixed version (ground truth):
/** 
 * A synchronized method for sending messages. If an IO error occurs, the error handlers will be notified with sendFailed, shutDown AND an IOException will be thrown. In case of a serialization error the error handler will be notified with sendFailed(). The header is filled with the message length 
 * @param header - the header for the message, must not be null
 * @param message - the message to send, must not be null
 * @throws IOException - if the message could not send due to an IOException
 * @throws IllegalArgumentException - if the given message is null
 */
public synchronized void send(MessageHeader header,String message) throws IOException, IllegalArgumentException {
  Validate.notNull(header,"String_Node_Str");
  Validate.notNull(message,"String_Node_Str");
  try {
    header.setMessageLength(message.length());
    String serializedHeader=m_headerSerializer.serialize(header);
    MessageWriter writer=new MessageWriter(new OutputStreamWriter(m_outputStream,IO_STREAM_ENCODING));
    writer.write(MessageHeader.HEADER_START);
    writer.write(StringConstants.EMPTY + serializedHeader.length());
    writer.newLine();
    writer.write(serializedHeader);
    writer.write(message);
    writer.flush();
    if (getLogger().isInfoEnabled()) {
      getLogger().info("String_Node_Str" + m_socket.getRemoteSocketAddress() + "String_Node_Str"+ serializedHeader);
    }
    if (getLogger().isDebugEnabled()) {
      getLogger().debug("String_Node_Str" + message);
    }
  }
 catch (  IOException ioe) {
    getLogger().error("String_Node_Str",ioe);
    fireSendFailed(message,header);
    fireShutDown();
    throw ioe;
  }
catch (  SerialisationException se) {
    getLogger().error("String_Node_Str" + header.toString() + "String_Node_Str",se);
    fireSendFailed(message,header);
  }
}