Program: 20179
Project: 20179
Buggy source:
public Instance pipe(Instance carrier){
  CharSequence string=(CharSequence)carrier.getData();
  StringTokenization dataTokens=new StringTokenization(string);
  TokenSequence targetTokens=new TokenSequence();
  String tag=backgroundTag;
  String nextTag=backgroundTag;
  Matcher m=sgmlPattern.matcher(string);
  int textStart=0;
  int textEnd=0;
  int nextStart=0;
  boolean done=false;
  logger.fine(sgmlPattern.pattern());
  logger.finer(string.toString());
  while (!done) {
    done=!(m.find());
    if (done)     textEnd=string.length();
 else {
      String sgml=m.group();
      logger.finer("String_Node_Str" + sgml);
      int groupCount=m.groupCount();
      logger.finer(Integer.toString(groupCount));
      if (sgml.charAt(1) == '/')       nextTag=backgroundTag;
 else {
        nextTag=sgml.substring(1,sgml.length() - 1);
      }
      logger.finer("String_Node_Str" + nextTag);
      nextStart=m.end();
      textEnd=m.start();
      logger.finer("String_Node_Str" + textStart + "String_Node_Str"+ textEnd);
    }
    if (textEnd - textStart > 0) {
      logger.finer("String_Node_Str" + tag);
      logger.finer("String_Node_Str" + string.subSequence(textStart,textEnd));
      lexer.setCharSequence(string.subSequence(textStart,textEnd));
      while (lexer.hasNext()) {
        lexer.next();
        int tokStart=textStart + lexer.getStartOffset();
        int tokEnd=textStart + lexer.getEndOffset();
        dataTokens.add(new StringSpan(string,tokStart,tokEnd));
        targetTokens.add(new Token(tag));
      }
    }
    textStart=nextStart;
    tag=nextTag;
  }
  carrier.setData(dataTokens);
  carrier.setTarget(targetTokens);
  if (saveSource)   carrier.setSource(dataTokens);
  return carrier;
}

Fixed version (ground truth):
public Instance pipe(Instance carrier){
  CharSequence string=(CharSequence)carrier.getData();
  StringTokenization dataTokens=new StringTokenization(string);
  TokenSequence targetTokens=new TokenSequence();
  String tag=backgroundTag;
  String nextTag=backgroundTag;
  Matcher m=sgmlPattern.matcher(string);
  int textStart=0;
  int textEnd=0;
  int nextStart=0;
  boolean done=false;
  logger.fine(sgmlPattern.pattern());
  logger.finer(string.toString());
  while (!done) {
    done=!(m.find());
    if (done)     textEnd=string.length();
 else {
      String sgml=m.group();
      logger.finer("String_Node_Str" + sgml);
      int groupCount=m.groupCount();
      logger.finer(Integer.toString(groupCount));
      if (sgml.charAt(1) == '/')       nextTag=backgroundTag;
 else {
        nextTag=sgml.substring(1,sgml.length() - 1);
      }
      logger.finer("String_Node_Str" + nextTag);
      nextStart=m.end();
      textEnd=m.start();
      logger.finer("String_Node_Str" + textStart + "String_Node_Str"+ textEnd);
    }
    if (textEnd - textStart > 0) {
      logger.finer("String_Node_Str" + tag);
      logger.finer("String_Node_Str" + string.subSequence(textStart,textEnd));
      lexer.setCharSequence(string.subSequence(textStart,textEnd));
      while (lexer.hasNext()) {
        lexer.next();
        int tokStart=textStart + lexer.getStartOffset();
        int tokEnd=textStart + lexer.getEndOffset();
        dataTokens.add(new StringSpan(string,tokStart,tokEnd));
        targetTokens.add(new Token(tag));
      }
    }
    textStart=nextStart;
    tag=nextTag;
  }
  carrier.setData(dataTokens);
  carrier.setTarget(targetTokens);
  if (saveSource) {
    carrier.setSource(dataTokens);
  }
  return carrier;
}