Program: 104315
Project: 104315
Buggy source:
private void sendInstantMessage(){
  Contact contact=(Contact)contactSelectorBox.getMenu().getSelectedObject();
  OperationSetBasicInstantMessaging im=(OperationSetBasicInstantMessaging)contact.getProtocolProvider().getOperationSet(OperationSetBasicInstantMessaging.class);
  OperationSetTypingNotifications tn=(OperationSetTypingNotifications)contact.getProtocolProvider().getOperationSet(OperationSetTypingNotifications.class);
  String htmlText=getTextFromWriteArea("String_Node_Str");
  String plainText=getTextFromWriteArea(OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE);
  Message msg;
  if (im.isContentTypeSupported("String_Node_Str") && (htmlText.indexOf("String_Node_Str") > -1 || htmlText.indexOf("String_Node_Str") > -1 || htmlText.indexOf("String_Node_Str") > -1 || htmlText.indexOf("String_Node_Str") > -1)) {
    msg=im.createMessage(htmlText.getBytes(),"String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else {
    msg=im.createMessage(plainText);
  }
  this.refreshWriteArea();
  if (tn != null) {
    getChatWritePanel().stopTypingTimer();
  }
  try {
    im.sendInstantMessage(contact,msg);
  }
 catch (  IllegalStateException ex) {
    logger.error("String_Node_Str",ex);
    this.refreshWriteArea();
    this.processMessage(contact.getDisplayName(),new Date(System.currentTimeMillis()),Constants.OUTGOING_MESSAGE,msg.getContent(),msg.getContentType());
    this.processMessage(contact.getDisplayName(),new Date(System.currentTimeMillis()),Constants.ERROR_MESSAGE,Messages.getI18NString("String_Node_Str").getText(),"String_Node_Str");
  }
catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
    this.refreshWriteArea();
    this.processMessage(contact.getDisplayName(),new Date(System.currentTimeMillis()),Constants.OUTGOING_MESSAGE,msg.getContent(),msg.getContentType());
    this.processMessage(contact.getDisplayName(),new Date(System.currentTimeMillis()),Constants.ERROR_MESSAGE,Messages.getI18NString("String_Node_Str",new String[]{ex.getMessage()}).getText(),"String_Node_Str");
  }
}

Fixed version (ground truth):
private void sendInstantMessage(){
  Contact contact=(Contact)contactSelectorBox.getMenu().getSelectedObject();
  OperationSetBasicInstantMessaging im=(OperationSetBasicInstantMessaging)contact.getProtocolProvider().getOperationSet(OperationSetBasicInstantMessaging.class);
  OperationSetTypingNotifications tn=(OperationSetTypingNotifications)contact.getProtocolProvider().getOperationSet(OperationSetTypingNotifications.class);
  String htmlText=getTextFromWriteArea("String_Node_Str");
  String plainText=getTextFromWriteArea(OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE);
  Message msg;
  if (im.isContentTypeSupported("String_Node_Str") && (htmlText.indexOf("String_Node_Str") > -1 || htmlText.indexOf("String_Node_Str") > -1 || htmlText.indexOf("String_Node_Str") > -1 || htmlText.indexOf("String_Node_Str") > -1)) {
    msg=im.createMessage(htmlText,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else {
    msg=im.createMessage(plainText);
  }
  this.refreshWriteArea();
  if (tn != null) {
    getChatWritePanel().stopTypingTimer();
  }
  try {
    im.sendInstantMessage(contact,msg);
  }
 catch (  IllegalStateException ex) {
    logger.error("String_Node_Str",ex);
    this.refreshWriteArea();
    this.processMessage(contact.getDisplayName(),new Date(System.currentTimeMillis()),Constants.OUTGOING_MESSAGE,msg.getContent(),msg.getContentType());
    this.processMessage(contact.getDisplayName(),new Date(System.currentTimeMillis()),Constants.ERROR_MESSAGE,Messages.getI18NString("String_Node_Str").getText(),"String_Node_Str");
  }
catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
    this.refreshWriteArea();
    this.processMessage(contact.getDisplayName(),new Date(System.currentTimeMillis()),Constants.OUTGOING_MESSAGE,msg.getContent(),msg.getContentType());
    this.processMessage(contact.getDisplayName(),new Date(System.currentTimeMillis()),Constants.ERROR_MESSAGE,Messages.getI18NString("String_Node_Str",new String[]{ex.getMessage()}).getText(),"String_Node_Str");
  }
}