Program: 104398
Project: 104398
Buggy source:
/** 
 * Formats message smilies.
 * @param message The source message string.
 * @return The message string with properly formated smilies.
 */
private String processSmilies(String message,String contentType){
  String startPlainTextTag;
  String endPlainTextTag;
  if (contentType == null || contentType.equals(TEXT_CONTENT_TYPE) || "String_Node_Str".equals(contentType)) {
    startPlainTextTag="String_Node_Str";
    endPlainTextTag="String_Node_Str";
  }
 else {
    startPlainTextTag="String_Node_Str";
    endPlainTextTag="String_Node_Str";
  }
  ArrayList smiliesList=ImageLoader.getDefaultSmiliesPack();
  StringBuffer regexp=new StringBuffer();
  for (int i=0; i < smiliesList.size(); i++) {
    Smiley smiley=(Smiley)smiliesList.get(i);
    String[] smileyStrings=smiley.getSmileyStrings();
    for (int j=0; j < smileyStrings.length; j++) {
      regexp.append(GuiUtils.replaceSpecialRegExpChars(smileyStrings[j])).append("String_Node_Str");
    }
  }
  regexp=regexp.deleteCharAt(regexp.length() - 1);
  Pattern p=Pattern.compile(regexp.toString());
  Matcher m=p.matcher(message);
  StringBuffer msgBuffer=new StringBuffer();
  boolean matchSuccessfull=false;
  while (m.find()) {
    if (!matchSuccessfull)     matchSuccessfull=true;
    String matchGroup=m.group().trim();
    String replacement=endPlainTextTag + "String_Node_Str" + ImageLoader.getSmiley(matchGroup).getImagePath()+ "String_Node_Str"+ matchGroup+ "String_Node_Str"+ startPlainTextTag;
    m.appendReplacement(msgBuffer,GuiUtils.replaceSpecialRegExpChars(replacement));
  }
  m.appendTail(msgBuffer);
  return msgBuffer.toString();
}

Fixed version (ground truth):
/** 
 * Formats message smilies.
 * @param message The source message string.
 * @return The message string with properly formated smilies.
 */
private String processSmilies(String message,String contentType){
  String startPlainTextTag;
  String endPlainTextTag;
  if (contentType == null || contentType.equals(TEXT_CONTENT_TYPE) || "String_Node_Str".equals(contentType)) {
    startPlainTextTag="String_Node_Str";
    endPlainTextTag="String_Node_Str";
  }
 else {
    if (HTML_CONTENT_TYPE.equals(contentType)) {
      message=removeAltFromHTMLSmilies(message);
    }
    startPlainTextTag="String_Node_Str";
    endPlainTextTag="String_Node_Str";
  }
  ArrayList smiliesList=ImageLoader.getDefaultSmiliesPack();
  StringBuffer regexp=new StringBuffer();
  for (int i=0; i < smiliesList.size(); i++) {
    Smiley smiley=(Smiley)smiliesList.get(i);
    String[] smileyStrings=smiley.getSmileyStrings();
    for (int j=0; j < smileyStrings.length; j++) {
      regexp.append(GuiUtils.replaceSpecialRegExpChars(smileyStrings[j])).append("String_Node_Str");
    }
  }
  regexp=regexp.deleteCharAt(regexp.length() - 1);
  Pattern p=Pattern.compile(regexp.toString());
  Matcher m=p.matcher(message);
  StringBuffer msgBuffer=new StringBuffer();
  boolean matchSuccessfull=false;
  while (m.find()) {
    if (!matchSuccessfull)     matchSuccessfull=true;
    String matchGroup=m.group().trim();
    String replacement=endPlainTextTag + "String_Node_Str" + ImageLoader.getSmiley(matchGroup).getImagePath()+ "String_Node_Str"+ matchGroup+ "String_Node_Str"+ startPlainTextTag;
    m.appendReplacement(msgBuffer,GuiUtils.replaceSpecialRegExpChars(replacement));
  }
  m.appendTail(msgBuffer);
  return msgBuffer.toString();
}