Program: 8735
Project: 8735
Buggy source:
private Statement convertToUnion(String query,Statement statement,int startParseIndex) throws ParseException {
  int start=query.indexOf("String_Node_Str",startParseIndex);
  String begin=query.substring(0,start);
  XPathToSQL2Converter converter=new XPathToSQL2Converter();
  String partList=query.substring(start);
  converter.initialize(partList);
  converter.read();
  int lastParseIndex=converter.parseIndex;
  int lastOrIndex=lastParseIndex;
  converter.read("String_Node_Str");
  int level=0;
  ArrayList<String> parts=new ArrayList<String>();
  while (true) {
    int parseIndex=converter.parseIndex;
    if (converter.readIf("String_Node_Str")) {
      level++;
    }
 else     if (converter.readIf("String_Node_Str") && level-- <= 0) {
      break;
    }
 else     if (converter.readIf("String_Node_Str") && level == 0) {
      String or=partList.substring(lastOrIndex,lastParseIndex);
      parts.add(or);
      lastOrIndex=parseIndex;
    }
 else     if (currentTokenType == END) {
      throw getSyntaxError("String_Node_Str");
    }
 else {
      converter.read();
    }
    lastParseIndex=parseIndex;
  }
  String or=partList.substring(lastOrIndex,lastParseIndex);
  parts.add(or);
  String end=partList.substring(lastParseIndex + 1);
  Statement result=null;
  for (  String p : parts) {
    String q=begin + p + end;
    converter=new XPathToSQL2Converter();
    Statement stat=converter.convertToStatement(q);
    if (result == null) {
      result=stat;
    }
 else {
      UnionStatement union=new UnionStatement(result,stat);
      union.orderList=stat.orderList;
      union.queryOptions=stat.queryOptions;
      result=union;
    }
    stat.orderList=new ArrayList<Order>();
    stat.queryOptions=new QueryOptions();
  }
  return result;
}

Fixed version (ground truth):
private Statement convertToUnion(String query,Statement statement,int startParseIndex) throws ParseException {
  int start=query.indexOf("String_Node_Str",startParseIndex);
  String begin=query.substring(0,start);
  XPathToSQL2Converter converter=new XPathToSQL2Converter();
  String partList=query.substring(start);
  converter.initialize(partList);
  converter.read();
  int lastParseIndex=converter.parseIndex;
  int lastOrIndex=lastParseIndex;
  converter.read("String_Node_Str");
  int level=0;
  ArrayList<String> parts=new ArrayList<String>();
  int parseIndex;
  while (true) {
    parseIndex=converter.parseIndex;
    if (converter.readIf("String_Node_Str")) {
      level++;
    }
 else     if (converter.readIf("String_Node_Str") && level-- <= 0) {
      break;
    }
 else     if (converter.readIf("String_Node_Str") && level == 0) {
      String or=partList.substring(lastOrIndex,lastParseIndex);
      parts.add(or);
      lastOrIndex=parseIndex;
    }
 else     if (converter.currentTokenType == END) {
      throw getSyntaxError("String_Node_Str");
    }
 else {
      converter.read();
    }
    lastParseIndex=parseIndex;
  }
  String or=partList.substring(lastOrIndex,lastParseIndex);
  parts.add(or);
  String end=partList.substring(parseIndex);
  Statement result=null;
  for (  String p : parts) {
    String q=begin + p + end;
    converter=new XPathToSQL2Converter();
    Statement stat=converter.convertToStatement(q);
    if (result == null) {
      result=stat;
    }
 else {
      UnionStatement union=new UnionStatement(result,stat);
      union.orderList=stat.orderList;
      union.queryOptions=stat.queryOptions;
      result=union;
    }
    stat.orderList=new ArrayList<Order>();
    stat.queryOptions=new QueryOptions();
  }
  return result;
}