Program: 101498
Project: 101498
Buggy source:
/** 
 * Turn the string into a list of tags in the order that they appear in the original string.
 */
private List parseTags(Book book,Key key,String aRemains){
  String remains=aRemains;
  List taglist=new ArrayList();
  while (true) {
    int ltpos=remains.indexOf('<');
    int gtpos=remains.indexOf('>',ltpos + 1);
    if (ltpos == -1 || gtpos == -1) {
      if (ltpos >= 0 && ltpos < remains.length() && Character.isUpperCase(remains.charAt(ltpos + 1))) {
        DataPolice.report("String_Node_Str" + remains);
      }
      if (gtpos != -1 && ltpos >= 0) {
        DataPolice.report("String_Node_Str" + remains);
      }
      int pos=Math.max(ltpos,gtpos) + 1;
      if (pos == 0 || pos == remains.length()) {
        taglist.add(GBFTagBuilders.getTextTag(remains));
        break;
      }
      taglist.add(GBFTagBuilders.getTextTag(remains.substring(0,pos)));
      remains=remains.substring(pos);
      continue;
    }
    char firstChar=remains.charAt(ltpos + 1);
    if (!Character.isUpperCase(firstChar)) {
      taglist.add(GBFTagBuilders.getTextTag(remains.substring(0,gtpos + 1)));
      remains=remains.substring(gtpos + 1);
      continue;
    }
    String start=remains.substring(0,ltpos);
    int strLen=start.length();
    if (strLen > 0) {
      int beginIndex=0;
      boolean inSepStr=SEPARATORS.indexOf(start.charAt(0)) >= 0;
      for (int i=1; inSepStr && i < strLen; i++) {
        char currentChar=start.charAt(i);
        if (!(SEPARATORS.indexOf(currentChar) >= 0)) {
          taglist.add(GBFTagBuilders.getTextTag(start.substring(beginIndex,i)));
          beginIndex=i;
          inSepStr=false;
        }
      }
      if (beginIndex < strLen) {
        taglist.add(GBFTagBuilders.getTextTag(start.substring(beginIndex)));
      }
    }
    String tag=remains.substring(ltpos + 1,gtpos);
    int length=tag.length();
    if (length > 0) {
      Tag reply=GBFTagBuilders.getTag(book,key,tag);
      if (reply != null) {
        taglist.add(reply);
      }
    }
    remains=remains.substring(gtpos + 1);
  }
  return taglist;
}

Fixed version (ground truth):
/** 
 * Turn the string into a list of tags in the order that they appear in the original string.
 */
private List parseTags(Book book,Key key,String aRemains){
  String remains=aRemains;
  List taglist=new ArrayList();
  while (true) {
    int ltpos=remains.indexOf('<');
    int gtpos=remains.indexOf('>',ltpos + 1);
    if (ltpos == -1 || gtpos == -1) {
      if (ltpos >= 0 && ltpos < remains.length() + 1 && Character.isUpperCase(remains.charAt(ltpos + 1))) {
        DataPolice.report("String_Node_Str" + remains);
      }
      if (gtpos != -1 && ltpos >= 0) {
        DataPolice.report("String_Node_Str" + remains);
      }
      int pos=Math.max(ltpos,gtpos) + 1;
      if (pos == 0 || pos == remains.length()) {
        taglist.add(GBFTagBuilders.getTextTag(remains));
        break;
      }
      taglist.add(GBFTagBuilders.getTextTag(remains.substring(0,pos)));
      remains=remains.substring(pos);
      continue;
    }
    char firstChar=remains.charAt(ltpos + 1);
    if (!Character.isUpperCase(firstChar)) {
      taglist.add(GBFTagBuilders.getTextTag(remains.substring(0,gtpos + 1)));
      remains=remains.substring(gtpos + 1);
      continue;
    }
    String start=remains.substring(0,ltpos);
    int strLen=start.length();
    if (strLen > 0) {
      int beginIndex=0;
      boolean inSepStr=SEPARATORS.indexOf(start.charAt(0)) >= 0;
      for (int i=1; inSepStr && i < strLen; i++) {
        char currentChar=start.charAt(i);
        if (!(SEPARATORS.indexOf(currentChar) >= 0)) {
          taglist.add(GBFTagBuilders.getTextTag(start.substring(beginIndex,i)));
          beginIndex=i;
          inSepStr=false;
        }
      }
      if (beginIndex < strLen) {
        taglist.add(GBFTagBuilders.getTextTag(start.substring(beginIndex)));
      }
    }
    String tag=remains.substring(ltpos + 1,gtpos);
    int length=tag.length();
    if (length > 0) {
      Tag reply=GBFTagBuilders.getTag(book,key,tag);
      if (reply != null) {
        taglist.add(reply);
      }
    }
    remains=remains.substring(gtpos + 1);
  }
  return taglist;
}