nus-yam/ex-repair huggingface dataset:
Program: 24707
Project: 24707
Buggy source:
/** 
 * Callback interface for SAX: not for application use
 */
public void comment(CharSequence chars,int locationId,int properties) throws XPathException {
  if (tree.commentBuffer == null) {
    tree.commentBuffer=new FastStringBuffer(200);
  }
  int s=tree.commentBuffer.length();
  tree.commentBuffer.append(chars.toString());
  nodeNr=tree.addNode(Type.COMMENT,currentDepth,s,chars.length(),-1);
  int prev=prevAtDepth[currentDepth];
  if (prev > 0) {
    tree.next[prev]=nodeNr;
  }
  tree.next[nodeNr]=prevAtDepth[currentDepth - 1];
  prevAtDepth[currentDepth]=nodeNr;
  siblingsAtDepth[currentDepth]++;
}

Fixed version (ground truth):
/** 
 * Callback interface for SAX: not for application use
 */
public void comment(CharSequence chars,int locationId,int properties) throws XPathException {
}
Program: 24708
Project: 24708
Buggy source:
/** 
 * Callback interface for SAX: not for application use<BR>
 */
public void processingInstruction(String piname,CharSequence remainder,int locationId,int properties) throws XPathException {
  if (tree.commentBuffer == null) {
    tree.commentBuffer=new FastStringBuffer(200);
  }
  int s=tree.commentBuffer.length();
  tree.commentBuffer.append(remainder.toString());
  int nameCode=namePool.allocate("String_Node_Str","String_Node_Str",piname);
  nodeNr=tree.addNode(Type.PROCESSING_INSTRUCTION,currentDepth,s,remainder.length(),nameCode);
  int prev=prevAtDepth[currentDepth];
  if (prev > 0) {
    tree.next[prev]=nodeNr;
  }
  tree.next[nodeNr]=prevAtDepth[currentDepth - 1];
  prevAtDepth[currentDepth]=nodeNr;
  siblingsAtDepth[currentDepth]++;
  LocationProvider locator=pipe.getLocationProvider();
  if (locator instanceof SourceLocationProvider) {
    tree.setSystemId(nodeNr,locator.getSystemId(locationId));
    if (lineNumbering) {
      tree.setLineNumber(nodeNr,locator.getLineNumber(locationId));
    }
  }
}

Fixed version (ground truth):
/** 
 * Callback interface for SAX: not for application use<BR>
 */
public void processingInstruction(String piname,CharSequence remainder,int locationId,int properties) throws XPathException {
}
Program: 24709
Project: 24709
Buggy source:
/** 
 * Read an existing frequency file, and add it to a file sorter.
 */
private void readFreqs(File inFile,FileSorter out,ProgressTracker prog) throws IOException {
  if (!inFile.canRead())   return;
  CountedInputStream countedIn=new CountedInputStream(new FileInputStream(inFile));
  BufferedReader freqReader=new BufferedReader(new InputStreamReader(countedIn));
  int lineCt=0;
  while (true) {
    String line=freqReader.readLine();
    if (line == null)     break;
    out.addLine(line);
    if ((lineCt++ & 0xfff) == 0)     prog.progress(countedIn.nRead(),inFile.length(),"String_Node_Str");
  }
  freqReader.close();
}

Fixed version (ground truth):
/** 
 * Read an existing frequency file, and add it to a file sorter.
 */
private void readFreqs(File inFile,FileSorter out,ProgressTracker prog) throws IOException {
  if (!inFile.canRead())   return;
  CountedInputStream countedIn=new CountedInputStream(new FileInputStream(inFile));
  BufferedReader freqReader=new BufferedReader(new InputStreamReader(countedIn,"String_Node_Str"));
  int lineCt=0;
  while (true) {
    String line=freqReader.readLine();
    if (line == null)     break;
    out.addLine(line);
    if ((lineCt++ & 0xfff) == 0)     prog.progress(countedIn.nRead(),inFile.length(),"String_Node_Str");
  }
  freqReader.close();
}
Program: 24710
Project: 24710
Buggy source:
/** 
 * Utility function that takes care of rewriting a series of span query clauses.
 * @param oldQuery    Query being rewritten
 * @param oldClauses  Clauses to rewrite
 * @param promoteSingle true to allow single-clause result to be returned,false to force wrapping.
 * @param joiner      Handles joining new clauses into wrapper query
 * @return            New rewritten query, or 'oldQuery' if no changes.
 */
protected Query rewriteClauses(Query oldQuery,SpanQuery[] oldClauses,boolean promoteSingle,SpanClauseJoiner joiner){
  Vector newClauses=new Vector();
  boolean anyChanges=false;
  for (int i=0; i < oldClauses.length; i++) {
    SpanQuery clause=(SpanQuery)rewriteQuery(oldClauses[i]);
    if (clause != oldClauses[i])     anyChanges=true;
    if (clause == null)     continue;
    newClauses.add(clause);
  }
  boolean force=forceRewrite(oldQuery);
  if (!anyChanges && !force)   return oldQuery;
  if (newClauses.isEmpty())   return null;
  if (newClauses.size() == 1) {
    return combineBoost(oldQuery,(SpanQuery)newClauses.get(0));
  }
  SpanQuery[] newArray=(SpanQuery[])newClauses.toArray(new SpanQuery[newClauses.size()]);
  Query newQuery=joiner.join(newArray);
  return copyBoost(oldQuery,newQuery);
}

Fixed version (ground truth):
/** 
 * Utility function that takes care of rewriting a series of span query clauses.
 * @param oldQuery    Query being rewritten
 * @param oldClauses  Clauses to rewrite
 * @param promoteSingle true to allow single-clause result to be returned,false to force wrapping.
 * @param joiner      Handles joining new clauses into wrapper query
 * @return            New rewritten query, or 'oldQuery' if no changes.
 */
protected Query rewriteClauses(Query oldQuery,SpanQuery[] oldClauses,boolean promoteSingle,SpanClauseJoiner joiner){
  Vector newClauses=new Vector();
  boolean anyChanges=false;
  for (int i=0; i < oldClauses.length; i++) {
    SpanQuery clause=(SpanQuery)rewriteQuery(oldClauses[i]);
    if (clause != oldClauses[i])     anyChanges=true;
    if (clause == null)     continue;
    newClauses.add(clause);
  }
  boolean force=forceRewrite(oldQuery);
  if (!anyChanges && !force)   return oldQuery;
  if (newClauses.isEmpty())   return null;
  if (newClauses.size() == 1 && promoteSingle) {
    return combineBoost(oldQuery,(SpanQuery)newClauses.get(0));
  }
  SpanQuery[] newArray=(SpanQuery[])newClauses.toArray(new SpanQuery[newClauses.size()]);
  Query newQuery=joiner.join(newArray);
  return copyBoost(oldQuery,newQuery);
}
Program: 24714
Project: 24714
Buggy source:
protected void formatHits(String mainTagName,HttpServletRequest req,HttpServletResponse res,AttribList attribs,QueryRequest queryRequest,QueryResult queryResult,long startTime) throws Exception {
  nHits=queryResult.totalDocs;
  super.formatHits(mainTagName,req,res,attribs,queryRequest,queryResult,startTime);
}

Fixed version (ground truth):
protected void formatHits(String mainTagName,HttpServletRequest req,HttpServletResponse res,AttribList attribs,QueryRequest queryRequest,QueryResult queryResult,long startTime) throws Exception {
  nHits.set(queryResult.totalDocs);
  super.formatHits(mainTagName,req,res,attribs,queryRequest,queryResult,startTime);
}
Program: 24715
Project: 24715
Buggy source:
protected void genErrorPage(HttpServletRequest req,HttpServletResponse res,Exception exc){
  nHits=-1;
  Trace.error("String_Node_Str" + exc);
  throw new RuntimeException(exc);
}

Fixed version (ground truth):
protected void genErrorPage(HttpServletRequest req,HttpServletResponse res,Exception exc){
  nHits.set(-1);
  Trace.error("String_Node_Str" + exc);
  throw new RuntimeException(exc);
}
Program: 24716
Project: 24716
Buggy source:
/** 
 * Check if the given string is all lower-case 
 */
public static boolean isLowerCase(String in){
  return in.equals(in.toLowerCase());
}

Fixed version (ground truth):
/** 
 * Check if the given string is all lower-case 
 */
public static boolean isLowerCase(String in){
  if (in == null || in.length() == 0)   return false;
  for (int i=0; i < in.length(); i++) {
    if (!Character.isLowerCase(in.charAt(i)))     return false;
  }
  return true;
}
Program: 24717
Project: 24717
Buggy source:
/** 
 * Break a string up into words, defined by whitespace boundaries.
 * @param in a string to break up
 * @return an array of the words in the string
 */
public static String[] splitWords(String in){
  if (in.trim().length() == 0)   return new String[0];
  return spacePat.split(in.trim());
}

Fixed version (ground truth):
/** 
 * Break a string up into words, defined by whitespace boundaries.
 * @param in a string to break up
 * @return an array of the words in the string
 */
public static String[] splitWords(String in){
  if (in == null)   return new String[0];
  String trimmed=in.trim();
  if (trimmed.length() == 0)   return new String[0];
  return spacePat.split(trimmed);
}
Program: 24718
Project: 24718
Buggy source:
/** 
 * Checks if the given string is "title case", i.e. the first letter is uppercase and the rest are lower case. If the string has multiple words, checks if *each* word is title case.
 */
public static boolean isTitleCase(String in){
  String[] words=splitWords(in);
  if (words.length == 1) {
    String word=words[0];
    if (word.length() <= 1)     return false;
    return Character.isUpperCase(word.charAt(0)) && isLowerCase(word.substring(1));
  }
  for (int i=0; i < words.length; i++) {
    if (!isTitleCase(words[i]))     return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks if the given string is "title case", i.e. the first letter is uppercase and the rest are lower case. If the string has multiple words, checks if *each* word is title case.
 */
public static boolean isTitleCase(String in){
  if (in == null || in.length() == 0)   return false;
  String[] words=splitWords(in);
  if (words.length == 1) {
    String word=words[0];
    if (word.length() <= 1)     return false;
    return Character.isUpperCase(word.charAt(0)) && isLowerCase(word.substring(1));
  }
  for (int i=0; i < words.length; i++) {
    if (!isTitleCase(words[i]))     return false;
  }
  return true;
}
Program: 24719
Project: 24719
Buggy source:
/** 
 * Check if the given string is all upper-case 
 */
public static boolean isUpperCase(String in){
  return in.equals(in.toUpperCase());
}

Fixed version (ground truth):
/** 
 * Check if the given string is all upper-case 
 */
public static boolean isUpperCase(String in){
  if (in == null || in.length() == 0)   return false;
  for (int i=0; i < in.length(); i++) {
    if (!Character.isUpperCase(in.charAt(i)))     return false;
  }
  return true;
}
Program: 24720
Project: 24720
Buggy source:
/** 
 * Convert a string to "title case", i.e. making the first letter of each word uppercase, and the rest of the letters lowercase.
 */
public static String toTitleCase(String in){
  String[] words=splitWords(in);
  if (words.length == 0)   return in;
  if (words.length == 1) {
    String word=words[0];
    if (word.length() < 1)     return word;
    return Character.toUpperCase(word.charAt(0)) + word.substring(1);
  }
  String[] converted=new String[words.length];
  for (int i=0; i < words.length; i++)   converted[i]=toTitleCase(words[i]);
  return join(converted);
}

Fixed version (ground truth):
/** 
 * Convert a string to "title case", i.e. making the first letter of each word uppercase, and the rest of the letters lowercase.
 */
public static String toTitleCase(String in){
  String[] words=splitWords(in);
  if (words.length == 0)   return in;
  if (words.length == 1) {
    String word=words[0];
    if (word.length() < 1)     return word;
    return Character.toUpperCase(word.charAt(0)) + word.substring(1).toLowerCase();
  }
  String[] converted=new String[words.length];
  for (int i=0; i < words.length; i++)   converted[i]=toTitleCase(words[i]);
  return join(converted);
}
Program: 24721
Project: 24721
Buggy source:
/** 
 * Copy this node to a given receiver
 * @param whichNamespaces indicates which namespaces should be copied: all, none,or local (i.e., those not declared on a parent element)
 */
public void copy(Receiver out,int whichNamespaces,boolean copyAnnotations,int locationId) throws XPathException {
  int typeCode=(copyAnnotations ? getTypeAnnotation() : StandardNames.XS_UNTYPED);
  if (locationId == 0 && out instanceof LocationCopier) {
    out.setSystemId(getSystemId());
    ((LocationCopier)out).setLineNumber(getLineNumber());
  }
  out.startElement(nameCode,typeCode,locationId,0);
  if (whichNamespaces != NO_NAMESPACES)   sendNamespaceDeclarations(out,whichNamespaces == ALL_NAMESPACES);
  if (attrNames != null) {
    for (int i=0; i < attrNames.length; i++) {
      new AttributeImpl(this,i).copy(out,NO_NAMESPACES,copyAnnotations,locationId);
    }
  }
  AxisIterator children=iterateAxis(Axis.CHILD);
  int childNamespaces=(whichNamespaces == NO_NAMESPACES ? NO_NAMESPACES : LOCAL_NAMESPACES);
  while (true) {
    NodeInfo next=(NodeInfo)children.next();
    if (next == null)     break;
    next.copy(out,childNamespaces,copyAnnotations,locationId);
  }
  out.endElement();
}

Fixed version (ground truth):
/** 
 * Copy this node to a given receiver
 * @param whichNamespaces indicates which namespaces should be copied: all, none,or local (i.e., those not declared on a parent element)
 */
public void copy(Receiver out,int whichNamespaces,boolean copyAnnotations,int locationId) throws XPathException {
  int typeCode=(copyAnnotations ? getTypeAnnotation() : StandardNames.XS_UNTYPED);
  if (locationId == 0 && out instanceof LocationCopier) {
    out.setSystemId(getSystemId());
    ((LocationCopier)out).setLineNumber(getLineNumber());
  }
  out.startElement(nameCode,typeCode,locationId,0);
  if (whichNamespaces != NO_NAMESPACES)   sendNamespaceDeclarations(out,whichNamespaces == ALL_NAMESPACES);
  out.startContent();
  if (attrNames != null) {
    for (int i=0; i < attrNames.length; i++) {
      new AttributeImpl(this,i).copy(out,NO_NAMESPACES,copyAnnotations,locationId);
    }
  }
  AxisIterator children=iterateAxis(Axis.CHILD);
  int childNamespaces=(whichNamespaces == NO_NAMESPACES ? NO_NAMESPACES : LOCAL_NAMESPACES);
  while (true) {
    NodeInfo next=(NodeInfo)children.next();
    if (next == null)     break;
    next.copy(out,childNamespaces,copyAnnotations,locationId);
  }
  out.endElement();
}
Program: 24722
Project: 24722
Buggy source:
/** 
 * Checks that the tree doesn't use features we don't support. If it does, we throw an exception.
 */
private void checkSupport() throws IOException {
  if (tree.getAttributeTypeCodeArray() != null)   throw new IOException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Checks that the tree doesn't use features we don't support. If it does, we throw an exception.
 */
private void checkSupport() throws IOException {
  if (tree.getAttributeTypeCodeArray() != null || tree.getTypeCodeArray() != null) {
  }
}
Program: 24723
Project: 24723
Buggy source:
/** 
 * Completes writing out a disk-based file. Assumes that the receiver (which must come from begin()) has been sent all the SAX events for the input document.
 */
public void finish(Receiver inBuilder,boolean closeStore) throws IOException {
  HackedTinyBuilder builder=(HackedTinyBuilder)inBuilder;
  StructuredStore treeStore=builder.getTreeStore();
  tree=builder.getTree();
  builder.getTextStore().close();
  if (tree == null) {
    treeStore.delete();
    return;
  }
  checkSupport();
  writeNames(treeStore.createSubStore("String_Node_Str"));
  writeAttrs(treeStore.createSubStore("String_Node_Str"));
  writeNodes(treeStore.createSubStore("String_Node_Str"));
  if (closeStore)   treeStore.close();
  tree=null;
  names=null;
}

Fixed version (ground truth):
/** 
 * Completes writing out a disk-based file. Assumes that the receiver (which must come from begin()) has been sent all the SAX events for the input document.
 */
public void finish(Receiver inBuilder,boolean closeStore) throws IOException {
  HackedTinyBuilder builder=(HackedTinyBuilder)inBuilder;
  StructuredStore treeStore=builder.getTreeStore();
  tree=builder.getTree();
  builder.getTextStore().close();
  builder.setTextStore(null);
  if (tree == null) {
    treeStore.delete();
    return;
  }
  checkSupport();
  writeNames(treeStore.createSubStore("String_Node_Str"));
  writeAttrs(treeStore.createSubStore("String_Node_Str"));
  writeNodes(treeStore.createSubStore("String_Node_Str"));
  if (closeStore)   treeStore.close();
  tree=null;
  names=null;
}
Program: 24728
Project: 24728
Buggy source:
/** 
 * Completes writing out a disk-based file. Assumes that the receiver (which must come from begin()) has been sent all the SAX events for the input document.
 */
public void finish(Receiver inBuilder,boolean closeStore) throws IOException {
  HackedTinyBuilder builder=(HackedTinyBuilder)inBuilder;
  StructuredStore treeStore=builder.getTreeStore();
  tree=builder.getTree();
  builder.getTextStore().close();
  if (tree == null) {
    treeStore.close();
    treeStore.delete();
    return;
  }
  checkSupport();
  writeNames(treeStore.createSubStore("String_Node_Str"));
  writeAttrs(treeStore.createSubStore("String_Node_Str"));
  writeNodes(treeStore.createSubStore("String_Node_Str"));
  if (closeStore)   treeStore.close();
  tree=null;
  names=null;
}

Fixed version (ground truth):
/** 
 * Completes writing out a disk-based file. Assumes that the receiver (which must come from begin()) has been sent all the SAX events for the input document.
 */
public void finish(Receiver inBuilder,boolean closeStore) throws IOException {
  HackedTinyBuilder builder=(HackedTinyBuilder)inBuilder;
  StructuredStore treeStore=builder.getTreeStore();
  tree=builder.getTree();
  builder.getTextStore().close();
  if (tree == null) {
    treeStore.delete();
    return;
  }
  checkSupport();
  writeNames(treeStore.createSubStore("String_Node_Str"));
  writeAttrs(treeStore.createSubStore("String_Node_Str"));
  writeNodes(treeStore.createSubStore("String_Node_Str"));
  if (closeStore)   treeStore.close();
  tree=null;
  names=null;
}
Program: 24729
Project: 24729
Buggy source:
/** 
 * Instances should never be created by outside parties, so the constructor is strictly private.
 */
private StructuredFile(File file,boolean create) throws IOException {
  this.file=file;
  if (!create && !file.exists())   throw new FileNotFoundException(file.toString());
  realFile=new RandomAccessFile(file,"String_Node_Str");
  if (create) {
    realFile.setLength(0);
    realFile.writeByte('s');
    realFile.writeByte('s');
    realFile.writeByte('f');
    realFile.writeByte(0);
    realFile.writeInt(0);
    dir=new Directory();
    writeDirectory();
  }
 else   readHeader();
}

Fixed version (ground truth):
/** 
 * Instances should never be created by outside parties, so the constructor is strictly private.
 */
private StructuredFile(File file,boolean create) throws IOException {
  this.file=file;
  if (!create && !file.exists())   throw new FileNotFoundException(file.toString());
  realFile=new RandomAccessFile(file,"String_Node_Str");
  try {
    if (create) {
      realFile.setLength(0);
      realFile.writeByte('s');
      realFile.writeByte('s');
      realFile.writeByte('f');
      realFile.writeByte(0);
      realFile.writeInt(0);
      dir=new Directory();
      writeDirectory();
    }
 else     readHeader();
  }
 catch (  IOException e) {
    if (realFile != null)     realFile.close();
    file.delete();
    throw e;
  }
}
Program: 24730
Project: 24730
Buggy source:
/** 
 * Resize the array so it exactly fits the current elements 
 */
public final void compact(){
  if (size != data.length)   resize(size);
}

Fixed version (ground truth):
/** 
 * Resize the array so it exactly fits the current elements 
 */
public final void compact(){
  resize(size);
}
Program: 24731
Project: 24731
Buggy source:
/** 
 * Resize the array to the specified size. If smaller than the current number of elements, the ones at the end will be lost.
 */
public final void resize(int newSize){
  if (newSize != size) {
    int[] oldData=data;
    data=new int[newSize];
    System.arraycopy(oldData,0,data,0,Math.min(size,newSize));
    size=Math.min(size,newSize);
  }
}

Fixed version (ground truth):
/** 
 * Resize the array to the specified size. If smaller than the current number of elements, the ones at the end will be lost.
 */
public final void resize(int newSize){
  if (newSize != data.length) {
    int[] oldData=data;
    data=new int[newSize];
    System.arraycopy(oldData,0,data,0,Math.min(size,newSize));
    size=Math.min(size,newSize);
  }
}
Program: 24732
Project: 24732
Buggy source:
/** 
 * Resize the array so it exactly fits the current elements 
 */
public final void compact(){
  if (size != data.length)   resize(size);
}

Fixed version (ground truth):
/** 
 * Resize the array so it exactly fits the current elements 
 */
public final void compact(){
  resize(size);
}
Program: 24733
Project: 24733
Buggy source:
/** 
 * Resize the array to the specified size. If smaller than the current number of elements, the ones at the end will be lost.
 */
public final void resize(int newSize){
  if (newSize != size) {
    long[] oldData=data;
    data=new long[newSize];
    System.arraycopy(oldData,0,data,0,Math.min(size,newSize));
    size=Math.min(size,newSize);
  }
}

Fixed version (ground truth):
/** 
 * Resize the array to the specified size. If smaller than the current number of elements, the ones at the end will be lost.
 */
public final void resize(int newSize){
  if (newSize != data.length) {
    long[] oldData=data;
    data=new long[newSize];
    System.arraycopy(oldData,0,data,0,Math.min(size,newSize));
    size=Math.min(size,newSize);
  }
}
Program: 24734
Project: 24734
Buggy source:
/** 
 * Apply the standard mapping to the given term. 
 * @return changed version, or original term if no change required.
 */
public String filter(String term){
  dribble.nextToken=term;
  try {
    Token mapped=filter.next();
    if (mapped.termText().equals(term))     return term;
    return mapped.termText();
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str" + e);
  }
}

Fixed version (ground truth):
/** 
 * Apply the standard mapping to the given term. 
 * @return changed version, or original term if no change required.
 */
public String filter(String term){
  dribble.nextToken=saveWildcards(term);
  try {
    Token mapped=filter.next();
    String restored=restoreWildcards(mapped.termText());
    if (restored.equals(term))     return term;
    return restored;
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str" + e);
  }
}
Program: 24735
Project: 24735
Buggy source:
private String filter(String in){
  String out=(String)recent.get(in);
  if (out == null) {
    out=stdTermFilter.filter(in);
    String tmp;
    tmp=accentMap.mapWord(out);
    if (tmp != null)     out=tmp;
    tmp=pluralMap.lookup(out);
    if (tmp != null)     out=tmp;
    recent.put(in,out);
  }
  return out;
}

Fixed version (ground truth):
private String filter(String in){
  String out=(String)recent.get(in);
  if (out == null) {
    out=stdTermFilter.filter(in);
    String tmp;
    if (accentMap != null) {
      tmp=accentMap.mapWord(out);
      if (tmp != null)       out=tmp;
    }
    tmp=pluralMap.lookup(out);
    if (pluralMap != null) {
      if (tmp != null)       out=tmp;
      recent.put(in,out);
    }
  }
  return out;
}
Program: 24736
Project: 24736
Buggy source:
/** 
 * Construct a new rewriter to use the given map 
 */
public AccentFoldingRewriter(CharMap accentMap){
  this.accentMap=accentMap;
}

Fixed version (ground truth):
/** 
 * Construct a new rewriter to use the given map 
 * @param tokFields 
 */
public AccentFoldingRewriter(CharMap accentMap,Set tokFields){
  this.accentMap=accentMap;
  this.tokenizedFields=tokFields;
}
Program: 24738
Project: 24738
Buggy source:
/** 
 * Keyword-oriented spelling suggestion mechanism. For an ordered list of terms which can appear in any of the specified fields, come up with suggestions that have a good chance of improving  the precision and/or recall.
 * @param terms           Ordered list of query terms
 * @param fields          Unordered list of fields they can appear in
 * @param indexReader     Used to obtain term frequencies
 * @return                One suggestion per term. If unchanged, therewas no better suggestion. If null, it is suggested that the term be deleted.
 */
public synchronized String[] suggestKeywords(String[] terms,String[] fields) throws IOException {
  if (terms.length == 0)   return terms;
  Phrase bestPhrase=new Phrase();
  bestPhrase.descrip="String_Node_Str";
  bestPhrase.words=new Word[terms.length];
  for (int i=0; i < terms.length; i++)   bestPhrase.words[i]=new Word(terms[i]);
  bestPhrase.calcScore();
  if (terms.length == 1)   return subWord(bestPhrase,0).toStringArray();
  for (int i=0; i < terms.length - 1; i++)   bestPhrase=subPair(bestPhrase,i);
  return bestPhrase.toStringArray();
}

Fixed version (ground truth):
/** 
 * Keyword-oriented spelling suggestion mechanism. For an ordered list of terms, come up with suggestions that have a good chance of improving   the precision and/or recall.
 * @param terms           Ordered list of query terms
 * @param indexReader     Used to obtain term frequencies
 * @return                One suggestion per term. If unchanged, therewas no better suggestion. If null, it is suggested that the term be deleted.
 */
public synchronized String[] suggestKeywords(String[] terms) throws IOException {
  if (terms.length == 0)   return terms;
  Phrase bestPhrase=new Phrase();
  bestPhrase.descrip="String_Node_Str";
  bestPhrase.words=new Word[terms.length];
  for (int i=0; i < terms.length; i++)   bestPhrase.words[i]=new Word(terms[i]);
  bestPhrase.calcScore();
  if (terms.length == 1)   return subWord(bestPhrase,0).toStringArray();
  for (int i=0; i < terms.length - 1; i++)   bestPhrase=subPair(bestPhrase,i);
  return bestPhrase.toStringArray();
}
Program: 24740
Project: 24740
Buggy source:
/** 
 * Flush any accumulated pairs, with their counts. For efficiency, skip any  pair that appeared only once.
 */
private void flushRecentPairs() throws IOException {
  if (recentPairs.isEmpty())   return;
  openPairQueueWriter();
  Set keySet=recentPairs.keySet();
  ArrayList list=new ArrayList(keySet);
  Collections.sort(list);
  for (int i=0; i < list.size(); i++) {
    String key=(String)list.get(i);
    int count=((Integer)recentPairs.get(key)).intValue();
    if (count > 1)     pairQueueWriter.println(key + "String_Node_Str" + count);
  }
  pairQueueWriter.flush();
  recentPairs.clear();
}

Fixed version (ground truth):
/** 
 * Flush any accumulated pairs, with their counts. For efficiency, skip any  pair that appeared only once.
 */
private void flushRecentPairs() throws IOException {
  if (recentPairs.isEmpty())   return;
  openPairQueueWriter();
  Set<String> keySet=recentPairs.keySet();
  ArrayList<String> list=new ArrayList<String>(keySet);
  Collections.sort(list);
  for (int i=0; i < list.size(); i++) {
    String key=list.get(i);
    int count=recentPairs.get(key).intValue();
    if (count > 1)     pairQueueWriter.println(key + "String_Node_Str" + count);
  }
  pairQueueWriter.flush();
  recentPairs.clear();
}
Program: 24741
Project: 24741
Buggy source:
/** 
 * Flush any accumulated words, with their counts.
 */
private void flushRecentWords() throws IOException {
  if (recentWords.isEmpty())   return;
  openWordQueueWriter();
  Set keySet=recentWords.keySet();
  ArrayList list=new ArrayList(keySet);
  Collections.sort(list);
  for (int i=0; i < list.size(); i++) {
    String key=(String)list.get(i);
    int count=((Integer)recentWords.get(key)).intValue();
    wordQueueWriter.println(key + "String_Node_Str" + count);
  }
  wordQueueWriter.flush();
  recentWords.clear();
}

Fixed version (ground truth):
/** 
 * Flush any accumulated words, with their counts.
 */
private void flushRecentWords() throws IOException {
  if (recentWords.isEmpty())   return;
  openWordQueueWriter();
  Set<String> keySet=recentWords.keySet();
  ArrayList<String> list=new ArrayList<String>(keySet);
  Collections.sort(list);
  for (int i=0; i < list.size(); i++) {
    String key=list.get(i);
    int count=recentWords.get(key).intValue();
    wordQueueWriter.println(key + "String_Node_Str" + count);
  }
  wordQueueWriter.flush();
  recentWords.clear();
}
Program: 24742
Project: 24742
Buggy source:
/** 
 * Closes the queue writers if either are open 
 */
private void closeQueueWriters() throws IOException {
  if (wordQueueWriter != null) {
    flushRecentWords();
    wordQueueWriter.close();
    wordQueueWriter=null;
  }
  if (pairQueueWriter != null) {
    flushRecentPairs();
    recentPairs=null;
    pairQueueWriter.close();
    pairQueueWriter=null;
  }
}

Fixed version (ground truth):
/** 
 * Closes the queue writers if either are open 
 */
private void closeQueueWriters() throws IOException {
  flushRecentWords();
  if (wordQueueWriter != null) {
    wordQueueWriter.close();
    wordQueueWriter=null;
  }
  flushRecentPairs();
  if (pairQueueWriter != null) {
    recentPairs=null;
    pairQueueWriter.close();
    pairQueueWriter=null;
  }
}
Program: 24743
Project: 24743
Buggy source:
/** 
 * Queue the given word if not recently checked. Caller should periodically call checkFlush() to see whether the queue is getting full. The queue will auto-expand if necessary, but it's better to flush it when near full.
 */
public synchronized void queueWord(String prevWord,String word) throws IOException {
  if (prevWord != null) {
    String key=prevWord + "String_Node_Str" + word;
    Integer val=(Integer)recentPairs.get(key);
    if (val == null)     val=IntegerValues.valueOf(1);
 else     val=IntegerValues.valueOf(val.intValue() + 1);
    recentPairs.put(key,val);
    if (recentPairs.size() >= MAX_RECENT_PAIRS)     flushRecentPairs();
  }
  Integer val=(Integer)recentWords.get(word);
  if (val == null)   val=IntegerValues.valueOf(1);
 else   val=IntegerValues.valueOf(val.intValue() + 1);
  recentWords.put(word,val);
  if (recentWords.size() >= MAX_RECENT_WORDS)   flushRecentWords();
}

Fixed version (ground truth):
/** 
 * Queue the given word if not recently checked. Caller should periodically call checkFlush() to see whether the queue is getting full. The queue will auto-expand if necessary, but it's better to flush it when near full.
 */
public synchronized void queueWord(String prevWord,String word) throws IOException {
  if (prevWord != null) {
    String key=prevWord + "String_Node_Str" + word;
    Integer val=recentPairs.get(key);
    if (val == null)     val=IntegerValues.valueOf(1);
 else     val=IntegerValues.valueOf(val.intValue() + 1);
    recentPairs.put(key,val);
    if (recentPairs.size() >= MAX_RECENT_PAIRS)     flushRecentPairs();
  }
  Integer val=recentWords.get(word);
  if (val == null)   val=IntegerValues.valueOf(1);
 else   val=IntegerValues.valueOf(val.intValue() + 1);
  recentWords.put(word,val);
  if (recentWords.size() >= MAX_RECENT_WORDS)   flushRecentWords();
}
Program: 24744
Project: 24744
Buggy source:
/** 
 */
private static int[][] form(int n,int m){
  int[][] d=new int[n + 1][m + 1];
  for (int i=0; i <= n; i++) {
    d[i][0]=i;
  }
  for (int j=0; j <= m; j++) {
    d[0][j]=j;
  }
  return d;
}

Fixed version (ground truth):
/** 
 */
private static int[][] form(int n,int m){
  int[][] d=new int[n + 1][m + 1];
  for (int i=0; i <= n; i++) {
    d[i][0]=i * 2;
  }
  for (int j=0; j <= m; j++) {
    d[0][j]=j;
  }
  return d;
}
Program: 24745
Project: 24745
Buggy source:
public final void resize(int newSize){
  if (newSize != size) {
    data=ArrayUtil.resize(data,newSize);
    if (newSize > size)     Arrays.fill(data,size,newSize,0.0f);
  }
}

Fixed version (ground truth):
public final void resize(int newSize){
  if (newSize != size) {
    data=ArrayUtil.resize(data,newSize);
    if (newSize > size)     Arrays.fill(data,size,newSize,0.0f);
    size=newSize;
  }
}
Program: 24746
Project: 24746
Buggy source:
public final void resize(int newSize){
  if (newSize != size) {
    data=ArrayUtil.resize(data,newSize);
    if (newSize > size)     Arrays.fill(data,size,newSize,0);
  }
}

Fixed version (ground truth):
public final void resize(int newSize){
  if (newSize != size) {
    data=ArrayUtil.resize(data,newSize);
    if (newSize > size)     Arrays.fill(data,size,newSize,0);
    size=newSize;
  }
}
Program: 24747
Project: 24747
Buggy source:
public final void resize(int newSize){
  if (newSize != size) {
    data=ArrayUtil.resize(data,newSize);
    if (newSize > size)     Arrays.fill(data,size,newSize,0L);
  }
}

Fixed version (ground truth):
public final void resize(int newSize){
  if (newSize != size) {
    data=ArrayUtil.resize(data,newSize);
    if (newSize > size)     Arrays.fill(data,size,newSize,0L);
    size=newSize;
  }
}
Program: 24748
Project: 24748
Buggy source:
public final void resize(int newSize){
  if (newSize != size) {
    data=ArrayUtil.resize(data,newSize);
    if (newSize > size)     Arrays.fill(data,size,newSize,null);
  }
}

Fixed version (ground truth):
public final void resize(int newSize){
  if (newSize != size) {
    data=ArrayUtil.resize(data,newSize);
    if (newSize > size)     Arrays.fill(data,size,newSize,null);
    size=newSize;
  }
}
Program: 24749
Project: 24749
Buggy source:
public SendInstruction(String url){
  this.url=url;
}

Fixed version (ground truth):
public SendInstruction(Expression urlExp){
  this.urlExp=urlExp;
}
Program: 24750
Project: 24750
Buggy source:
public Item evaluateItem(XPathContext context) throws XPathException {
  HttpServletResponse res=TextServlet.getCurResponse();
  String encodedUrl=res.encodeRedirectURL(url);
  try {
    res.sendRedirect(encodedUrl);
  }
 catch (  IOException e) {
    throw new DynamicError(e);
  }
  return null;
}

Fixed version (ground truth):
public Item evaluateItem(XPathContext context) throws XPathException {
  HttpServletResponse res=TextServlet.getCurResponse();
  String url=urlExp.evaluateAsString(context);
  String encodedUrl=res.encodeRedirectURL(url);
  try {
    res.sendRedirect(encodedUrl);
  }
 catch (  IOException e) {
    throw new DynamicError(e);
  }
  return null;
}
Program: 24751
Project: 24751
Buggy source:
public void prepareAttributes() throws TransformerConfigurationException {
  url=getAttributeList().getValue("String_Node_Str","String_Node_Str");
  if (url == null)   reportAbsence("String_Node_Str");
}

Fixed version (ground truth):
public void prepareAttributes() throws TransformerConfigurationException {
  String urlAtt=getAttributeList().getValue("String_Node_Str","String_Node_Str");
  if (urlAtt == null)   reportAbsence("String_Node_Str");
  urlExp=makeAttributeValueTemplate(urlAtt);
}
Program: 24752
Project: 24752
Buggy source:
public Expression compile(Executable exec) throws TransformerConfigurationException {
  return new SendInstruction(url);
}

Fixed version (ground truth):
public Expression compile(Executable exec) throws TransformerConfigurationException {
  return new SendInstruction(urlExp);
}
Program: 24753
Project: 24753
Buggy source:
/** 
 * Processes the main query node, turning it into a Lucene query.
 * @param main The 'query' element
 */
private void parseOutput(EasyNode main){
  if (main.name().equals("String_Node_Str"))   throw new QueryFormatError(main.attrValue("String_Node_Str"));
  for (int i=0; i < main.nAttrs(); i++) {
    String name=main.attrName(i);
    String val=main.attrValue(i);
    parseMainAttrib(main,name,val);
  }
  int nChildQueries=0;
  for (int i=0; i < main.nChildren(); i++) {
    EasyNode el=main.child(i);
    if (!el.isElement())     continue;
 else     if ("String_Node_Str".equalsIgnoreCase(el.name()))     parseFacetSpec(el);
 else     if ("String_Node_Str".equalsIgnoreCase(el.name()))     parseSpellcheck(el);
 else     if ("String_Node_Str".equalsIgnoreCase(el.name()))     continue;
 else {
      req.query=deChunk(parseQuery(el,null,DEFAULT_MAX_SNIPPETS));
      nChildQueries++;
    }
  }
  if (nChildQueries > 1) {
    error("String_Node_Str" + main.name() + "String_Node_Str"+ "String_Node_Str");
  }
  if (main.name().equals("String_Node_Str") && Trace.getOutputLevel() >= Trace.debug) {
    Trace.debug("String_Node_Str" + req.query);
  }
  if (main.name().equals("String_Node_Str")) {
    if (req.indexPath == null)     error("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Processes the main query node, turning it into a Lucene query.
 * @param main The 'query' element
 */
private void parseOutput(EasyNode main){
  if (main.name().equals("String_Node_Str"))   throw new QueryFormatError(main.attrValue("String_Node_Str"));
  int maxSnippets=DEFAULT_MAX_SNIPPETS;
  for (int i=0; i < main.nAttrs(); i++) {
    String name=main.attrName(i);
    String val=main.attrValue(i);
    if (name.equals("String_Node_Str")) {
      int oldVal=maxSnippets;
      maxSnippets=parseIntAttrib(main,name);
      if (maxSnippets < 0)       maxSnippets=999999999;
    }
 else     parseMainAttrib(main,name,val);
  }
  int nChildQueries=0;
  for (int i=0; i < main.nChildren(); i++) {
    EasyNode el=main.child(i);
    if (!el.isElement())     continue;
 else     if ("String_Node_Str".equalsIgnoreCase(el.name()))     parseFacetSpec(el);
 else     if ("String_Node_Str".equalsIgnoreCase(el.name()))     parseSpellcheck(el);
 else     if ("String_Node_Str".equalsIgnoreCase(el.name()))     continue;
 else {
      req.query=deChunk(parseQuery(el,null,DEFAULT_MAX_SNIPPETS));
      nChildQueries++;
    }
  }
  if (nChildQueries > 1) {
    error("String_Node_Str" + main.name() + "String_Node_Str"+ "String_Node_Str");
  }
  if (main.name().equals("String_Node_Str") && Trace.getOutputLevel() >= Trace.debug) {
    Trace.debug("String_Node_Str" + req.query);
  }
  if (main.name().equals("String_Node_Str")) {
    if (req.indexPath == null)     error("String_Node_Str");
  }
}
Program: 24754
Project: 24754
Buggy source:
/** 
 * Rewrite a wildcard term query. Removes diacritics from words.
 * @param q  The query to rewrite
 * @return   Rewritten version, or 'q' unchanged if no changed needed.
 */
protected Query rewrite(SpanWildcardQuery q){
  Term t=q.getTerm();
  String mapped=accentMap.mapWord(t.text());
  if (mapped == null)   return q;
  Term newTerm=new Term(t.field(),mapped);
  return copyBoost(q,new SpanWildcardQuery(newTerm,q.getTermLimit()));
}

Fixed version (ground truth):
/** 
 * Rewrite a wildcard term query. Removes diacritics from words.
 * @param q  The query to rewrite
 * @return   Rewritten version, or 'q' unchanged if no changed needed.
 */
protected Query rewrite(SpanWildcardQuery q){
}
Program: 24755
Project: 24755
Buggy source:
/** 
 * Checks spelling of query terms, if spelling suggestion is enabled and the result falls below the cutoff threshholds.
 * @param req   Original query request
 * @param res   Results of the query
 */
private void spellCheck(QueryRequest req,QueryResult res) throws IOException {
  ArrayList queryTerms=gatherTerms(req.query);
  SpellcheckParams params=req.spellcheckParams;
  if (params.docScoreCutoff > 0 && maxDocScore > params.docScoreCutoff)   return;
  if (params.totalDocsCutoff > 0 && res.totalDocs > params.totalDocsCutoff)   return;
  ArrayList out=new ArrayList();
  for (int i=0; i < queryTerms.size(); i++) {
    Term term=(Term)queryTerms.get(i);
    if (params.fields != null && !params.fields.contains(term.field()))     continue;
    SpellingSuggestion sugg=new SpellingSuggestion();
    sugg.origTerm=term;
    sugg.altWords=spellReader.suggestSimilar(term.text(),req.spellcheckParams.suggestionsPerTerm,indexReader,term.field(),params.termOccurrenceFactor,params.accuracy);
    if (sugg.altWords.length > 0)     out.add(sugg);
  }
  if (out.size() > 0) {
    res.suggestions=(SpellingSuggestion[])out.toArray(new SpellingSuggestion[out.size()]);
  }
}

Fixed version (ground truth):
/** 
 * Checks spelling of query terms, if spelling suggestion is enabled and the result falls below the cutoff threshholds.
 * @param req   Original query request
 * @param res   Results of the query
 */
private void spellCheck(QueryRequest req,QueryResult res) throws IOException {
  ArrayList queryTerms=gatherTerms(req.query);
  SpellcheckParams params=req.spellcheckParams;
  int totalDocs=res.totalDocs;
  if (res.facets != null) {
    for (int i=0; i < res.facets.length; i++) {
      if (res.facets[i].rootGroup != null)       totalDocs=Math.max(totalDocs,res.facets[i].rootGroup.totalDocs);
    }
  }
  if (params.docScoreCutoff > 0 && maxDocScore > params.docScoreCutoff)   return;
  if (params.totalDocsCutoff > 0 && totalDocs > params.totalDocsCutoff)   return;
  ArrayList out=new ArrayList();
  for (int i=0; i < queryTerms.size(); i++) {
    Term term=(Term)queryTerms.get(i);
    if (params.fields != null && !params.fields.contains(term.field()))     continue;
    SpellingSuggestion sugg=new SpellingSuggestion();
    sugg.origTerm=term;
    sugg.altWords=spellReader.suggestSimilar(term.text(),req.spellcheckParams.suggestionsPerTerm,indexReader,term.field(),params.termOccurrenceFactor,params.accuracy);
    if (sugg.altWords.length > 0)     out.add(sugg);
  }
  if (out.size() > 0) {
    res.suggestions=(SpellingSuggestion[])out.toArray(new SpellingSuggestion[out.size()]);
  }
}
Program: 24757
Project: 24757
Buggy source:
/** 
 * Calculates and adds the "servlet.path" and "root.path" attributes  to the given transformer. Also adds "xtf.home" based on the servlet root directory.
 */
public void stuffSpecialAttribs(HttpServletRequest req,Transformer trans){
  String uri=req.getRequestURL().toString();
  if (!uri.startsWith("String_Node_Str"))   uri=req.getRequestURI();
  if (uri.indexOf('?') >= 0)   uri=uri.substring(0,uri.indexOf('?'));
  trans.setParameter("String_Node_Str",new StringValue(uri));
  trans.setParameter("String_Node_Str",new StringValue(uri));
  String rootPath=uri;
  if (rootPath.endsWith("String_Node_Str"))   rootPath=rootPath.substring(0,rootPath.length() - 1);
  int slashPos=rootPath.lastIndexOf('/');
  if (slashPos >= 1)   rootPath=rootPath.substring(0,slashPos);
  String lookFor="String_Node_Str";
  if (rootPath.endsWith(lookFor))   rootPath=rootPath.substring(0,rootPath.length() - lookFor.length());
  rootPath=rootPath + "String_Node_Str";
  trans.setParameter("String_Node_Str",new StringValue(rootPath));
  trans.setParameter("String_Node_Str",new StringValue(rootPath));
  String xtfHome=Path.normalizePath(getRealPath("String_Node_Str"));
  trans.setParameter("String_Node_Str",xtfHome);
  Enumeration i=req.getHeaderNames();
  trans.setParameter("String_Node_Str",getRequestURL(req));
  while (i.hasMoreElements()) {
    String name=(String)i.nextElement();
    String value=req.getHeader(name);
    trans.setParameter("String_Node_Str" + name,new StringValue(value));
  }
}

Fixed version (ground truth):
/** 
 * Calculates and adds the "servlet.path" and "root.path" attributes  to the given transformer. Also adds "xtf.home" based on the servlet root directory.
 */
public void stuffSpecialAttribs(HttpServletRequest req,Transformer trans){
  String uri=req.getRequestURL().toString();
  if (!uri.startsWith("String_Node_Str"))   uri=req.getRequestURI();
  if (uri.indexOf('?') >= 0)   uri=uri.substring(0,uri.indexOf('?'));
  uri=decodeURL(uri);
  uri=convertUTF8inURL(uri);
  trans.setParameter("String_Node_Str",new StringValue(uri));
  trans.setParameter("String_Node_Str",new StringValue(uri));
  String rootPath=uri;
  if (rootPath.endsWith("String_Node_Str"))   rootPath=rootPath.substring(0,rootPath.length() - 1);
  int slashPos=rootPath.lastIndexOf('/');
  if (slashPos >= 1)   rootPath=rootPath.substring(0,slashPos);
  String lookFor="String_Node_Str";
  if (rootPath.endsWith(lookFor))   rootPath=rootPath.substring(0,rootPath.length() - lookFor.length());
  rootPath=rootPath + "String_Node_Str";
  trans.setParameter("String_Node_Str",new StringValue(rootPath));
  trans.setParameter("String_Node_Str",new StringValue(rootPath));
  String xtfHome=Path.normalizePath(getRealPath("String_Node_Str"));
  trans.setParameter("String_Node_Str",xtfHome);
  Enumeration i=req.getHeaderNames();
  trans.setParameter("String_Node_Str",getRequestURL(req));
  while (i.hasMoreElements()) {
    String name=(String)i.nextElement();
    String value=req.getHeader(name);
    trans.setParameter("String_Node_Str" + name,new StringValue(value));
  }
}
Program: 24758
Project: 24758
Buggy source:
/** 
 * Gets the full URL, including query parameters, from an HTTP request. This is a bit tricky since different servlet containers return slightly different info.
 */
public static String getRequestURL(HttpServletRequest req){
  String url=req.getRequestURL().toString();
  if (url.indexOf('?') < 0 && req.getQueryString() != null && req.getQueryString().length() > 0) {
    url=url + "String_Node_Str" + req.getQueryString();
  }
  if (url.indexOf("String_Node_Str") >= 0)   url=url.replaceAll("String_Node_Str","String_Node_Str");
  return url;
}

Fixed version (ground truth):
/** 
 * Gets the full URL, including query parameters, from an HTTP request. This is a bit tricky since different servlet containers return slightly different info.
 */
public static String getRequestURL(HttpServletRequest req){
  String url=req.getRequestURL().toString();
  if (url.indexOf('?') < 0 && req.getQueryString() != null && req.getQueryString().length() > 0) {
    url=url + "String_Node_Str" + req.getQueryString();
  }
  if (url.indexOf("String_Node_Str") >= 0)   url=url.replaceAll("String_Node_Str","String_Node_Str");
  url=decodeURL(url);
  url=convertUTF8inURL(url);
  return url;
}
Program: 24759
Project: 24759
Buggy source:
public boolean skipTo(int target) throws IOException {
  dataPos=Math.max(dataPos,data.nextIndexAfterDoc(target) - 1);
  return next();
}

Fixed version (ground truth):
public boolean skipTo(int target) throws IOException {
  dataPos=Math.max(dataPos,data.findDocIndex(target) - 1);
  return next();
}
Program: 24760
Project: 24760
Buggy source:
/** 
 * Traverse a "more like this" query 
 */
protected void traverse(MoreLikeThisQuery mlt){
  traverseQuery(mlt.getSubQuery());
}

Fixed version (ground truth):
/** 
 * Traverse a numeric range query query 
 */
protected void traverse(NumericRangeQuery nrq){
}
Program: 24761
Project: 24761
Buggy source:
/** 
 * Traverse a query of any supported type.
 * @param q   Query to traverse
 */
public void traverseQuery(Query q){
  if (q instanceof SpanSectionTypeQuery)   traverse((SpanSectionTypeQuery)q);
 else   if (q instanceof SpanExactQuery)   traverse((SpanExactQuery)q);
 else   if (q instanceof MoreLikeThisQuery)   traverse((MoreLikeThisQuery)q);
 else   super.traverseQuery(q);
}

Fixed version (ground truth):
/** 
 * Traverse a query of any supported type.
 * @param q   Query to traverse
 */
public void traverseQuery(Query q){
  if (q instanceof SpanSectionTypeQuery)   traverse((SpanSectionTypeQuery)q);
 else   if (q instanceof SpanExactQuery)   traverse((SpanExactQuery)q);
 else   if (q instanceof MoreLikeThisQuery)   traverse((MoreLikeThisQuery)q);
 else   if (q instanceof NumericRangeQuery)   traverse((NumericRangeQuery)q);
 else   super.traverseQuery(q);
}