Program: 102928
Project: 102928
Buggy source:
/** 
 * Send instant message.
 * @param to contact to send message to
 * @param original message to send
 * @throws IllegalStateException in case of bad internal state
 * @throws IllegalArgumentException in case invalid arguments have beenpassed
 */
@Override public void sendInstantMessage(final Contact to,final Message original) throws IllegalStateException, IllegalArgumentException {
  if (!(original instanceof MessageIrcImpl)) {
    LOGGER.error("String_Node_Str" + "String_Node_Str");
    return;
  }
  final MessageDeliveredEvent[] msgDeliveryPendingEvts=messageDeliveryPendingTransform(new MessageDeliveredEvent(original,to));
  try {
    for (    MessageDeliveredEvent event : msgDeliveryPendingEvts) {
      if (event == null) {
        continue;
      }
      String transformedContent=event.getSourceMessage().getContent();
      MessageIrcImpl message=this.createMessage(transformedContent,original.getContentType(),original.getEncoding(),"String_Node_Str");
      final IrcConnection connection=this.provider.getIrcStack().getConnection();
      if (connection == null) {
        throw new IllegalStateException("String_Node_Str");
      }
      try {
        if (!event.isMessageEncrypted() && message.isCommand()) {
          try {
            connection.getMessageManager().command(to,message);
            MessageReceivedEvent systemEvent=new MessageReceivedEvent(message,to,new Date(),MessageReceivedEvent.SYSTEM_MESSAGE_RECEIVED);
            fireMessageEvent(systemEvent);
          }
 catch (          final UnsupportedCommandException e) {
            fireMessageDeliveryFailed(message,to,MessageDeliveryFailedEvent.UNSUPPORTED_OPERATION);
          }
catch (          BadCommandException e) {
            LOGGER.error("String_Node_Str" + "String_Node_Str" + "String_Node_Str",e);
            fireMessageDeliveryFailed(message,to,MessageDeliveryFailedEvent.INTERNAL_ERROR);
          }
catch (          BadCommandInvocationException e) {
            MessageIrcImpl helpMessage=new MessageIrcImpl(e.getHelp(),OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE,OperationSetBasicInstantMessaging.DEFAULT_MIME_ENCODING,"String_Node_Str");
            MessageReceivedEvent helpEvent=new MessageReceivedEvent(helpMessage,to,new Date(),MessageReceivedEvent.SYSTEM_MESSAGE_RECEIVED);
            fireMessageEvent(helpEvent);
          }
        }
 else {
          connection.getMessageManager().message(to,message);
          fireMessageDelivered(original,to);
        }
      }
 catch (      RuntimeException e) {
        LOGGER.debug("String_Node_Str" + message);
        throw e;
      }
    }
  }
 catch (  RuntimeException e) {
    LOGGER.warn("String_Node_Str" + original,e);
    fireMessageDeliveryFailed(original,to,MessageDeliveryFailedEvent.NETWORK_FAILURE);
  }
}

Fixed version (ground truth):
/** 
 * Send instant message.
 * @param to contact to send message to
 * @param original message to send
 * @throws IllegalStateException in case of bad internal state
 * @throws IllegalArgumentException in case invalid arguments have beenpassed
 */
@Override public void sendInstantMessage(final Contact to,final Message original) throws IllegalStateException, IllegalArgumentException {
  if (!(original instanceof MessageIrcImpl)) {
    LOGGER.error("String_Node_Str" + "String_Node_Str");
    return;
  }
  final IrcConnection connection=this.provider.getIrcStack().getConnection();
  if (connection == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  final MessageDeliveredEvent[] msgDeliveryPendingEvts=messageDeliveryPendingTransform(new MessageDeliveredEvent(original,to));
  if (msgDeliveryPendingEvts.length == 0) {
    LOGGER.warn("String_Node_Str" + "String_Node_Str");
    return;
  }
  try {
    for (    MessageDeliveredEvent event : msgDeliveryPendingEvts) {
      if (event == null) {
        continue;
      }
      String transformedContent=event.getSourceMessage().getContent();
      MessageIrcImpl message=this.createMessage(transformedContent,original.getContentType(),original.getEncoding(),"String_Node_Str");
      try {
        if (!event.isMessageEncrypted() && message.isCommand()) {
          try {
            connection.getMessageManager().command(to,message);
          }
 catch (          final UnsupportedCommandException e) {
            fireMessageDeliveryFailed(message,to,MessageDeliveryFailedEvent.UNSUPPORTED_OPERATION);
          }
catch (          BadCommandException e) {
            LOGGER.error("String_Node_Str" + "String_Node_Str" + "String_Node_Str",e);
            fireMessageDeliveryFailed(message,to,MessageDeliveryFailedEvent.INTERNAL_ERROR);
          }
catch (          BadCommandInvocationException e) {
            MessageIrcImpl helpMessage=new MessageIrcImpl(e.getHelp(),OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE,OperationSetBasicInstantMessaging.DEFAULT_MIME_ENCODING,"String_Node_Str");
            MessageReceivedEvent helpEvent=new MessageReceivedEvent(helpMessage,to,new Date(),MessageReceivedEvent.SYSTEM_MESSAGE_RECEIVED);
            fireMessageEvent(helpEvent);
          }
        }
 else {
          connection.getMessageManager().message(to,message);
        }
      }
 catch (      RuntimeException e) {
        LOGGER.debug("String_Node_Str" + message);
        throw e;
      }
    }
    fireMessageDelivered(original,to);
  }
 catch (  RuntimeException e) {
    LOGGER.warn("String_Node_Str" + original,e);
    fireMessageDeliveryFailed(original,to,MessageDeliveryFailedEvent.NETWORK_FAILURE);
  }
}