Program: 16206
Project: 16206
Buggy source:
private Expression readCondition() throws SQLException {
  if (readIf("String_Node_Str")) {
    return new ConditionNot(readCondition());
  }
  if (readIf("String_Node_Str")) {
    read("String_Node_Str");
    Query query=parseSelect();
    read("String_Node_Str");
    return new ConditionExists(query);
  }
  Expression r=readConcat();
  while (true) {
    int backup=parseIndex;
    boolean not=false;
    if (readIf("String_Node_Str")) {
      not=true;
      if (isToken("String_Node_Str")) {
        parseIndex=backup;
        currentToken="String_Node_Str";
        break;
      }
    }
    if (readIf("String_Node_Str")) {
      Expression b=readConcat();
      Expression esc=null;
      if (readIf("String_Node_Str")) {
        esc=readConcat();
      }
      recompileAlways=true;
      r=new CompareLike(database.getCompareMode(),r,b,esc,false);
    }
 else     if (readIf("String_Node_Str")) {
      Expression b=readConcat();
      r=new CompareLike(database.getCompareMode(),r,b,null,true);
    }
 else     if (readIf("String_Node_Str")) {
      int type;
      if (readIf("String_Node_Str")) {
        type=Comparison.IS_NOT_NULL;
      }
 else {
        type=Comparison.IS_NULL;
      }
      read("String_Node_Str");
      r=new Comparison(session,type,r,null);
    }
 else     if (readIf("String_Node_Str")) {
      if (SysProperties.OPTIMIZE_IN) {
        recompileAlways=true;
      }
      read("String_Node_Str");
      if (readIf("String_Node_Str")) {
        r=ValueExpression.get(ValueBoolean.get(false));
      }
 else {
        if (isToken("String_Node_Str") || isToken("String_Node_Str")) {
          Query query=parseSelect();
          r=new ConditionInSelect(database,r,query,false,Comparison.EQUAL);
        }
 else {
          ObjectArray v=new ObjectArray();
          Expression last;
          do {
            last=readExpression();
            v.add(last);
          }
 while (readIf("String_Node_Str"));
          if (v.size() == 1 && (last instanceof Subquery)) {
            Subquery s=(Subquery)last;
            Query q=s.getQuery();
            r=new ConditionInSelect(database,r,q,false,Comparison.EQUAL);
          }
 else {
            r=new ConditionIn(database,r,v);
          }
        }
        read("String_Node_Str");
      }
    }
 else     if (readIf("String_Node_Str")) {
      Expression low=readConcat();
      read("String_Node_Str");
      Expression high=readConcat();
      Expression condLow=new Comparison(session,Comparison.SMALLER_EQUAL,low,r);
      Expression condHigh=new Comparison(session,Comparison.BIGGER_EQUAL,high,r);
      r=new ConditionAndOr(ConditionAndOr.AND,condLow,condHigh);
    }
 else {
      int compareType=getCompareType(currentTokenType);
      if (compareType < 0) {
        break;
      }
      read();
      if (readIf("String_Node_Str")) {
        read("String_Node_Str");
        Query query=parseSelect();
        r=new ConditionInSelect(database,r,query,true,compareType);
        read("String_Node_Str");
      }
 else       if (readIf("String_Node_Str") || readIf("String_Node_Str")) {
        read("String_Node_Str");
        Query query=parseSelect();
        r=new ConditionInSelect(database,r,query,false,compareType);
        read("String_Node_Str");
      }
 else {
        Expression right=readConcat();
        if (readIf("String_Node_Str") && readIf("String_Node_Str") && readIf("String_Node_Str")) {
          if (r instanceof ExpressionColumn && right instanceof ExpressionColumn) {
            ExpressionColumn leftCol=(ExpressionColumn)r;
            ExpressionColumn rightCol=(ExpressionColumn)right;
            ObjectArray filters=currentSelect.getTopFilters();
            for (int i=0; filters != null && i < filters.size(); i++) {
              TableFilter f=(TableFilter)filters.get(i);
              while (f != null) {
                leftCol.mapColumns(f,0);
                rightCol.mapColumns(f,0);
                f=f.getJoin();
              }
            }
            TableFilter leftFilter=leftCol.getTableFilter();
            TableFilter rightFilter=rightCol.getTableFilter();
            r=new Comparison(session,compareType,r,right);
            if (leftFilter != null && rightFilter != null) {
              filters.remove(filters.indexOf(rightFilter));
              leftFilter.addJoin(rightFilter,true,r);
              r=ValueExpression.get(ValueBoolean.get(true));
            }
          }
        }
 else {
          r=new Comparison(session,compareType,r,right);
        }
      }
    }
    if (not) {
      r=new ConditionNot(r);
    }
  }
  return r;
}

Fixed version (ground truth):
private Expression readCondition() throws SQLException {
  if (readIf("String_Node_Str")) {
    return new ConditionNot(readCondition());
  }
  if (readIf("String_Node_Str")) {
    read("String_Node_Str");
    Query query=parseSelect();
    read("String_Node_Str");
    return new ConditionExists(query);
  }
  Expression r=readConcat();
  while (true) {
    int backup=parseIndex;
    boolean not=false;
    if (readIf("String_Node_Str")) {
      not=true;
      if (isToken("String_Node_Str")) {
        parseIndex=backup;
        currentToken="String_Node_Str";
        break;
      }
    }
    if (readIf("String_Node_Str")) {
      Expression b=readConcat();
      Expression esc=null;
      if (readIf("String_Node_Str")) {
        esc=readConcat();
      }
      recompileAlways=true;
      r=new CompareLike(database.getCompareMode(),r,b,esc,false);
    }
 else     if (readIf("String_Node_Str")) {
      Expression b=readConcat();
      r=new CompareLike(database.getCompareMode(),r,b,null,true);
    }
 else     if (readIf("String_Node_Str")) {
      int type;
      if (readIf("String_Node_Str")) {
        type=Comparison.IS_NOT_NULL;
      }
 else {
        type=Comparison.IS_NULL;
      }
      read("String_Node_Str");
      r=new Comparison(session,type,r,null);
    }
 else     if (readIf("String_Node_Str")) {
      if (SysProperties.OPTIMIZE_IN) {
        recompileAlways=true;
      }
      read("String_Node_Str");
      if (readIf("String_Node_Str")) {
        r=ValueExpression.get(ValueBoolean.get(false));
      }
 else {
        if (isToken("String_Node_Str") || isToken("String_Node_Str")) {
          Query query=parseSelect();
          r=new ConditionInSelect(database,r,query,false,Comparison.EQUAL);
        }
 else {
          ObjectArray v=new ObjectArray();
          Expression last;
          do {
            last=readExpression();
            v.add(last);
          }
 while (readIf("String_Node_Str"));
          if (v.size() == 1 && (last instanceof Subquery)) {
            Subquery s=(Subquery)last;
            Query q=s.getQuery();
            r=new ConditionInSelect(database,r,q,false,Comparison.EQUAL);
          }
 else {
            r=new ConditionIn(database,r,v);
          }
        }
        read("String_Node_Str");
      }
    }
 else     if (readIf("String_Node_Str")) {
      Expression low=readConcat();
      read("String_Node_Str");
      Expression high=readConcat();
      Expression condLow=new Comparison(session,Comparison.SMALLER_EQUAL,low,r);
      Expression condHigh=new Comparison(session,Comparison.BIGGER_EQUAL,high,r);
      r=new ConditionAndOr(ConditionAndOr.AND,condLow,condHigh);
    }
 else {
      int compareType=getCompareType(currentTokenType);
      if (compareType < 0) {
        break;
      }
      read();
      if (readIf("String_Node_Str")) {
        read("String_Node_Str");
        Query query=parseSelect();
        r=new ConditionInSelect(database,r,query,true,compareType);
        read("String_Node_Str");
      }
 else       if (readIf("String_Node_Str") || readIf("String_Node_Str")) {
        read("String_Node_Str");
        Query query=parseSelect();
        r=new ConditionInSelect(database,r,query,false,compareType);
        read("String_Node_Str");
      }
 else {
        Expression right=readConcat();
        if (readIf("String_Node_Str") && readIf("String_Node_Str") && readIf("String_Node_Str")) {
          if (r instanceof ExpressionColumn && right instanceof ExpressionColumn) {
            ExpressionColumn leftCol=(ExpressionColumn)r;
            ExpressionColumn rightCol=(ExpressionColumn)right;
            ObjectArray filters=currentSelect.getTopFilters();
            for (int i=0; filters != null && i < filters.size(); i++) {
              TableFilter f=(TableFilter)filters.get(i);
              while (f != null) {
                leftCol.mapColumns(f,0);
                rightCol.mapColumns(f,0);
                f=f.getJoin();
              }
            }
            TableFilter leftFilter=leftCol.getTableFilter();
            TableFilter rightFilter=rightCol.getTableFilter();
            r=new Comparison(session,compareType,r,right);
            if (leftFilter != null && rightFilter != null) {
              int idx=filters.indexOf(rightFilter);
              if (idx >= 0) {
                filters.remove(idx);
                leftFilter.addJoin(rightFilter,true,r);
              }
 else {
                rightFilter.mapAndAddFilter(r);
              }
              r=ValueExpression.get(ValueBoolean.get(true));
            }
          }
        }
 else {
          r=new Comparison(session,compareType,r,right);
        }
      }
    }
    if (not) {
      r=new ConditionNot(r);
    }
  }
  return r;
}