Program: 24763
Project: 24763
Buggy source:
/** 
 * Generate a proximity query on a field. This uses the de-duplicating span system.
 * @param parent The element containing the field name and terms.
 */
Query makeProxQuery(EasyNode parent,int slop,String field,int maxSnippets) throws QueryGenException {
  Vector terms=new Vector();
  Vector notVec=new Vector();
  for (int i=0; i < parent.nChildren(); i++) {
    EasyNode el=parent.child(i);
    if (!el.isElement())     continue;
    if (el.name().equals("String_Node_Str")) {
      if (parent.name().matches("String_Node_Str"))       error("String_Node_Str");
      notVec.add(parseQuery2(el,"String_Node_Str",field,maxSnippets));
    }
 else {
      SpanQuery q;
      if (slop == 0) {
        Term t=parseTerm(el,field,"String_Node_Str");
        if (isWildcardTerm(t))         q=new XtfSpanWildcardQuery(t,req.termLimit);
 else         q=new SpanTermQuery(t);
        q.setSpanRecording(maxSnippets);
        terms.add(q);
      }
 else       terms.add(parseQuery(el,field,maxSnippets));
    }
  }
  if (terms.size() == 0)   error("String_Node_Str" + parent.name() + "String_Node_Str"+ "String_Node_Str");
  SpanQuery q;
  SpanQuery[] termQueries=(SpanQuery[])terms.toArray(new SpanQuery[terms.size()]);
  if (slop < 0)   q=new SpanExactQuery(termQueries);
 else   if (terms.size() == 1)   q=(SpanQuery)terms.elementAt(0);
 else   if (parent.name().equals("String_Node_Str"))   q=new SpanOrNearQuery(termQueries,slop,true);
 else   q=new SpanNearQuery(termQueries,slop,slop == 0);
  q.setSpanRecording(maxSnippets);
  return processSpanNots(q,notVec,maxSnippets);
}

Fixed version (ground truth):
/** 
 * Generate a proximity query on a field. This uses the de-duplicating span system.
 * @param parent The element containing the field name and terms.
 */
Query makeProxQuery(EasyNode parent,int slop,String field,int maxSnippets) throws QueryGenException {
  Vector terms=new Vector();
  Vector notVec=new Vector();
  for (int i=0; i < parent.nChildren(); i++) {
    EasyNode el=parent.child(i);
    if (!el.isElement())     continue;
    if (el.name().equals("String_Node_Str")) {
      if (parent.name().matches("String_Node_Str"))       error("String_Node_Str");
      notVec.add(parseQuery2(el,"String_Node_Str",field,maxSnippets));
    }
 else     if (el.name().equals("String_Node_Str"))     continue;
 else {
      SpanQuery q;
      if (slop == 0) {
        Term t=parseTerm(el,field,"String_Node_Str");
        if (isWildcardTerm(t))         q=new XtfSpanWildcardQuery(t,req.termLimit);
 else         q=new SpanTermQuery(t);
        q.setSpanRecording(maxSnippets);
        terms.add(q);
      }
 else       terms.add(parseQuery(el,field,maxSnippets));
    }
  }
  if (terms.size() == 0)   error("String_Node_Str" + parent.name() + "String_Node_Str"+ "String_Node_Str");
  SpanQuery q;
  SpanQuery[] termQueries=(SpanQuery[])terms.toArray(new SpanQuery[terms.size()]);
  if (slop < 0)   q=new SpanExactQuery(termQueries);
 else   if (terms.size() == 1)   q=(SpanQuery)terms.elementAt(0);
 else   if (parent.name().equals("String_Node_Str"))   q=new SpanOrNearQuery(termQueries,slop,true);
 else   q=new SpanNearQuery(termQueries,slop,slop == 0);
  q.setSpanRecording(maxSnippets);
  return processSpanNots(q,notVec,maxSnippets);
}