Program: 101540
Project: 101540
Buggy source:
public static List rtfToOsis(String rtf){
  Element div=factory().createDiv();
  Stack stack=new Stack();
  stack.push(div);
  int strlen=rtf.length();
  StringBuffer text=new StringBuffer(strlen);
  int i=0;
  for (i=0; i < strlen; i++) {
    char curChar=rtf.charAt(i);
    if (curChar != '\\') {
      text.append(curChar);
      continue;
    }
    if (rtf.startsWith("String_Node_Str",i)) {
      Element currentElement=(Element)stack.pop();
      currentElement.addContent(text.toString());
      text.delete(0,text.length());
      stack.clear();
      stack.push(div);
      i+=(i + 5 < strlen && rtf.charAt(i + 5) == ' ') ? 5 : 4;
      continue;
    }
    if (rtf.startsWith("String_Node_Str",i)) {
      Element currentElement=(Element)stack.peek();
      currentElement.addContent(text.toString());
      text.delete(0,text.length());
      currentElement.addContent(OSISUtil.factory.createLB());
      i+=(i + 4 < strlen && rtf.charAt(i + 4) == ' ') ? 4 : 3;
      continue;
    }
    if (rtf.startsWith("String_Node_Str",i)) {
      Element centerDiv=OSISUtil.factory.createDiv();
      centerDiv.setAttribute(OSIS_ATTR_TYPE,"String_Node_Str");
      Element currentElement=(Element)stack.peek();
      currentElement.addContent(text.toString());
      text.delete(0,text.length());
      currentElement.addContent(centerDiv);
      stack.push(centerDiv);
      i+=(i + 3 < strlen && rtf.charAt(i + 3) == ' ') ? 3 : 2;
      continue;
    }
    if (rtf.startsWith("String_Node_Str",i)) {
      StringBuffer buf=new StringBuffer();
      i+=2;
      while (i < strlen) {
        char curDigit=rtf.charAt(i);
        if (curDigit != '-' && !Character.isDigit(curDigit)) {
          break;
        }
        buf.append(curDigit);
        i++;
      }
      int value=Integer.parseInt(buf.toString());
      if (value < 0) {
        value+=65536;
      }
      text.append((char)value);
      continue;
    }
    if (rtf.startsWith("String_Node_Str",i) || rtf.startsWith("String_Node_Str",i)) {
      Element currentElement=(Element)stack.pop();
      currentElement.addContent(text.toString());
      text.delete(0,text.length());
      i+=(i + 3 < strlen && rtf.charAt(i + 3) == ' ') ? 3 : 2;
      continue;
    }
    if (rtf.startsWith("String_Node_Str",i) || rtf.startsWith("String_Node_Str",i)) {
      i+=1;
      continue;
    }
    if (rtf.startsWith("String_Node_Str",i)) {
      Element hiElement=OSISUtil.factory.createHI();
      hiElement.setAttribute(OSIS_ATTR_TYPE,HI_ITALIC);
      Element currentElement=(Element)stack.peek();
      currentElement.addContent(text.toString());
      text.delete(0,text.length());
      currentElement.addContent(hiElement);
      stack.push(hiElement);
      i+=(i + 2 < strlen && rtf.charAt(i + 2) == ' ') ? 2 : 1;
      continue;
    }
    if (rtf.startsWith("String_Node_Str",i)) {
      Element hiElement=OSISUtil.factory.createHI();
      hiElement.setAttribute(OSIS_ATTR_TYPE,HI_BOLD);
      Element currentElement=(Element)stack.peek();
      currentElement.addContent(text.toString());
      text.delete(0,text.length());
      currentElement.addContent(hiElement);
      stack.push(hiElement);
      i+=(i + 2 < strlen && rtf.charAt(i + 2) == ' ') ? 2 : 1;
      continue;
    }
  }
  return div.cloneContent();
}

Fixed version (ground truth):
public static List rtfToOsis(String rtf){
  Element div=factory().createDiv();
  Stack stack=new Stack();
  stack.push(div);
  int strlen=rtf.length();
  StringBuffer text=new StringBuffer(strlen);
  int i=0;
  for (i=0; i < strlen; i++) {
    char curChar=rtf.charAt(i);
    if (curChar != '\\') {
      text.append(curChar);
      continue;
    }
    if (rtf.startsWith("String_Node_Str",i)) {
      Element currentElement=(Element)stack.pop();
      currentElement.addContent(text.toString());
      text.delete(0,text.length());
      stack.clear();
      stack.push(div);
      i+=(i + 5 < strlen && rtf.charAt(i + 5) == ' ') ? 5 : 4;
      continue;
    }
    if (rtf.startsWith("String_Node_Str",i)) {
      Element currentElement=(Element)stack.peek();
      currentElement.addContent(text.toString());
      text.delete(0,text.length());
      currentElement.addContent(OSISUtil.factory.createLB());
      i+=(i + 4 < strlen && rtf.charAt(i + 4) == ' ') ? 4 : 3;
      continue;
    }
    if (rtf.startsWith("String_Node_Str",i)) {
      Element centerDiv=OSISUtil.factory.createDiv();
      centerDiv.setAttribute(OSIS_ATTR_TYPE,"String_Node_Str");
      Element currentElement=(Element)stack.peek();
      currentElement.addContent(text.toString());
      text.delete(0,text.length());
      currentElement.addContent(centerDiv);
      stack.push(centerDiv);
      i+=(i + 3 < strlen && rtf.charAt(i + 3) == ' ') ? 3 : 2;
      continue;
    }
    if (rtf.startsWith("String_Node_Str",i)) {
      StringBuffer buf=new StringBuffer();
      i+=2;
      while (i < strlen) {
        char curDigit=rtf.charAt(i);
        if (curDigit != '-' && !Character.isDigit(curDigit)) {
          break;
        }
        buf.append(curDigit);
        i++;
      }
      int value=Integer.parseInt(buf.toString());
      if (value < 0) {
        value+=65536;
      }
      text.append((char)value);
      continue;
    }
    if (rtf.startsWith("String_Node_Str",i) || rtf.startsWith("String_Node_Str",i)) {
      Element currentElement=(Element)stack.pop();
      currentElement.addContent(text.toString());
      text.delete(0,text.length());
      i+=(i + 3 < strlen && rtf.charAt(i + 3) == ' ') ? 3 : 2;
      continue;
    }
    if (rtf.startsWith("String_Node_Str",i) || rtf.startsWith("String_Node_Str",i)) {
      i+=1;
      continue;
    }
    if (rtf.startsWith("String_Node_Str",i)) {
      Element hiElement=OSISUtil.factory.createHI();
      hiElement.setAttribute(OSIS_ATTR_TYPE,HI_ITALIC);
      Element currentElement=(Element)stack.peek();
      currentElement.addContent(text.toString());
      text.delete(0,text.length());
      currentElement.addContent(hiElement);
      stack.push(hiElement);
      i+=(i + 2 < strlen && rtf.charAt(i + 2) == ' ') ? 2 : 1;
      continue;
    }
    if (rtf.startsWith("String_Node_Str",i)) {
      Element hiElement=OSISUtil.factory.createHI();
      hiElement.setAttribute(OSIS_ATTR_TYPE,HI_BOLD);
      Element currentElement=(Element)stack.peek();
      currentElement.addContent(text.toString());
      text.delete(0,text.length());
      currentElement.addContent(hiElement);
      stack.push(hiElement);
      i+=(i + 2 < strlen && rtf.charAt(i + 2) == ' ') ? 2 : 1;
      continue;
    }
  }
  if (text.length() > 0) {
    div.addContent(text.toString());
  }
  return div.cloneContent();
}