Program: 24700
Project: 24700
Buggy source:
/** 
 * Performs all the manipulations and marking for a meta-data field.
 * @param name      Name of the field
 * @param value     Raw string value of the field
 * @param docContents   Where to get spans from
 * @param metaData  Where to put the resulting data
 * @param isTokenized true if the field was tokenized and should bemarked.
 */
private void loadMetaField(String name,String value,Document docContents,AttribList metaData,boolean isTokenized){
  String markedValue;
  if (isTokenized)   markedValue=snippetMaker.markField(docContents,fieldSpans,name,value);
 else   markedValue=value;
  StringBuffer buf=new StringBuffer(markedValue.length() * 2);
  int prevStart=0;
  boolean startFound=false;
  for (int i=0; i < markedValue.length(); i++) {
    char c=markedValue.charAt(i);
    if (c == Constants.FIELD_START_MARKER) {
      startFound=true;
      if (i > 0 && markedValue.charAt(i - 1) == '>') {
        int tagStart=buf.lastIndexOf("String_Node_Str");
        if (tagStart < prevStart)         throw new RuntimeException("String_Node_Str");
        buf.replace(tagStart + 1,tagStart + 2,name);
      }
 else {
        buf.append("String_Node_Str");
        buf.append(name);
        buf.append("String_Node_Str");
      }
    }
 else     if (c == Constants.FIELD_END_MARKER) {
      buf.append("String_Node_Str");
      buf.append(name);
      buf.append("String_Node_Str");
    }
 else     buf.append(c);
  }
  if (!startFound) {
    buf.insert(0,"String_Node_Str" + name + "String_Node_Str");
    buf.append("String_Node_Str" + name + "String_Node_Str");
  }
  markedValue=buf.toString();
  if (markedValue.indexOf(bumpMarker) < 0) {
    metaData.put(name,markedValue);
    return;
  }
  int startPos=0;
  while (startPos < markedValue.length()) {
    int bumpPos=markedValue.indexOf(bumpMarker,startPos);
    if (bumpPos < 0) {
      metaData.put(name,markedValue.substring(startPos));
      break;
    }
    String val=markedValue.substring(startPos,bumpPos);
    metaData.put(name,val);
    startPos=1 + markedValue.indexOf(bumpMarker,bumpPos + 1);
    if (Character.isWhitespace(markedValue.charAt(startPos)))     startPos++;
  }
}

Fixed version (ground truth):
/** 
 * Performs all the manipulations and marking for a meta-data field.
 * @param name      Name of the field
 * @param value     Raw string value of the field
 * @param docContents   Where to get spans from
 * @param metaData  Where to put the resulting data
 * @param isTokenized true if the field was tokenized and should bemarked.
 */
private void loadMetaField(String name,String value,Document docContents,AttribList metaData,boolean isTokenized){
  String markedValue;
  if (isTokenized)   markedValue=snippetMaker.markField(docContents,fieldSpans,name,value);
 else   markedValue=value;
  StringBuffer buf=new StringBuffer(markedValue.length() * 2);
  int prevStart=0;
  boolean startFound=false;
  for (int i=0; i < markedValue.length(); i++) {
    char c=markedValue.charAt(i);
    if (c == Constants.FIELD_START_MARKER) {
      startFound=true;
      if (i > 0 && markedValue.charAt(i - 1) == '>') {
        int tagStart=buf.lastIndexOf("String_Node_Str");
        if (tagStart < prevStart)         throw new RuntimeException("String_Node_Str");
        buf.replace(tagStart + 1,tagStart + 2,name);
      }
 else {
        buf.append("String_Node_Str");
        buf.append(name);
        buf.append("String_Node_Str");
      }
    }
 else     if (c == Constants.FIELD_END_MARKER) {
      buf.append("String_Node_Str");
      buf.append(name);
      buf.append("String_Node_Str");
    }
 else     buf.append(c);
  }
  if (!startFound) {
    if (buf.substring(0,3).equals("String_Node_Str"))     buf.replace(1,2,name);
 else     buf.insert(0,"String_Node_Str" + name + "String_Node_Str");
    buf.append("String_Node_Str" + name + "String_Node_Str");
  }
  markedValue=buf.toString();
  if (markedValue.indexOf(bumpMarker) < 0) {
    metaData.put(name,markedValue);
    return;
  }
  int startPos=0;
  while (startPos < markedValue.length()) {
    int bumpPos=markedValue.indexOf(bumpMarker,startPos);
    if (bumpPos < 0) {
      metaData.put(name,markedValue.substring(startPos));
      break;
    }
    String val=markedValue.substring(startPos,bumpPos);
    metaData.put(name,val);
    startPos=1 + markedValue.indexOf(bumpMarker,bumpPos + 1);
    if (Character.isWhitespace(markedValue.charAt(startPos)))     startPos++;
  }
}