nus-yam/ex-repair huggingface dataset:
Program: 24656
Project: 24656
Buggy source:
/** 
 * Adds a field to the on-disk list of tokenized fields for an index. Exceptions are handled internally and thrown as RuntimeException.
 */
private void addToTokenizedFieldsFile(String field){
  try {
    File tokFieldsFile=new File(Path.normalizePath(indexPath + "String_Node_Str"));
    FileWriter writer=new FileWriter(tokFieldsFile,true);
    writer.append(field + "String_Node_Str");
    writer.close();
  }
 catch (  Throwable t) {
    Trace.tab();
    Trace.error("String_Node_Str" + t);
    Trace.untab();
    if (t instanceof RuntimeException)     throw (RuntimeException)t;
 else     throw new RuntimeException(t);
  }
}

Fixed version (ground truth):
/** 
 * Adds a field to the on-disk list of tokenized fields for an index. Exceptions are handled internally and thrown as RuntimeException.
 */
private void addToTokenizedFieldsFile(String field){
  try {
    String path=Path.normalizePath(indexPath) + "String_Node_Str";
    File oldFile=new File(path);
    File tmpFile=new File(path + "String_Node_Str");
    BufferedWriter writer=new BufferedWriter(new FileWriter(tmpFile));
    try {
      if (oldFile.canRead()) {
        BufferedReader reader=new BufferedReader(new FileReader(oldFile));
        try {
          while (true) {
            String line=reader.readLine();
            if (line == null)             break;
            writer.write(line + "String_Node_Str");
          }
        }
  finally {
          reader.close();
        }
      }
      writer.write(field + "String_Node_Str");
    }
  finally {
      writer.close();
    }
    tmpFile.renameTo(oldFile);
  }
 catch (  Throwable t) {
    Trace.tab();
    Trace.error("String_Node_Str" + t);
    Trace.untab();
    if (t instanceof RuntimeException)     throw (RuntimeException)t;
 else     throw new RuntimeException(t);
  }
}
Program: 24658
Project: 24658
Buggy source:
/** 
 * Retrieve the next token in the stream. 
 */
public Token next() throws IOException {
  Token t=input.next();
  if (t == null)   return t;
  String term=t.termText();
  String mapped=accentMap.mapWord(term);
  if (mapped == null)   return t;
  Token newToken=new Token(mapped,t.startOffset(),t.endOffset(),t.type());
  newToken.setPositionIncrement(t.getPositionIncrement());
  return newToken;
}

Fixed version (ground truth):
/** 
 * Retrieve the next token in the stream. 
 */
public Token next() throws IOException {
  while (true) {
    Token t=input.next();
    if (t == null)     return t;
    String term=t.termText();
    String mapped=accentMap.mapWord(term);
    if (mapped == null)     return t;
    if (mapped.length() == 0)     continue;
    Token newToken=new Token(mapped,t.startOffset(),t.endOffset(),t.type());
    newToken.setPositionIncrement(t.getPositionIncrement());
    return newToken;
  }
}
Program: 24659
Project: 24659
Buggy source:
/** 
 * Retrieve the next token in the stream. 
 */
public Token next() throws IOException {
  while (true) {
    Token t=input.next();
    if (t == null)     return t;
    String term=t.termText();
    String mapped=accentMap.mapWord(term);
    if (mapped == null)     return t;
    if (mapped.length() == 0)     continue;
    Token newToken=new Token(mapped,t.startOffset(),t.endOffset(),t.type());
    newToken.setPositionIncrement(t.getPositionIncrement());
    return newToken;
  }
}

Fixed version (ground truth):
/** 
 * Retrieve the next token in the stream. 
 */
public Token next() throws IOException {
  int bumpAccum=0;
  while (true) {
    Token t=input.next();
    if (t == null)     return t;
    String term=t.termText();
    String mapped=accentMap.mapWord(term);
    if (mapped == null) {
      if (bumpAccum == 0)       return t;
      mapped=term;
    }
    if (mapped.length() == 0) {
      bumpAccum+=t.getPositionIncrement() - 1;
      continue;
    }
    Token newToken=new Token(mapped,t.startOffset(),t.endOffset(),t.type());
    newToken.setPositionIncrement(t.getPositionIncrement() + bumpAccum);
    return newToken;
  }
}
Program: 24660
Project: 24660
Buggy source:
/** 
 * Run an rsync command with the standard arguments plus the specified subdirectories and optional extra args.
 * @param src          Directory (or file) to match
 * @param dst          Directory (or file) to modify
 * @param subDirs      Sub-directories to rsync (null for all)
 * @throws IOException If anything goes wrong
 */
public void runRsync(File src,File dst,List<String> subDirs,String[] extraArgs) throws IOException {
  try {
    ArrayList<String> args=new ArrayList(6);
    args.add("String_Node_Str");
    args.add("String_Node_Str");
    args.add("String_Node_Str");
    if (extraArgs != null) {
      for (      String extra : extraArgs)       args.add(extra);
    }
    if (src.isDirectory())     args.add("String_Node_Str" + src.getAbsolutePath() + "String_Node_Str");
    if (subDirs != null) {
      args.add("String_Node_Str");
      for (      String subDir : subDirs)       args.add(src.getAbsolutePath() + "String_Node_Str" + subDir);
    }
 else     args.add(src.getAbsolutePath() + (src.isDirectory() ? "String_Node_Str" : "String_Node_Str"));
    args.add(dst.getAbsolutePath() + (dst.isDirectory() ? "String_Node_Str" : "String_Node_Str"));
    String[] argArray=args.toArray(new String[args.size()]);
    ProcessRunner.runAndGrab(argArray,"String_Node_Str",0);
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
catch (  CommandFailedException e) {
    throw new IOException(e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Run an rsync command with the standard arguments plus the specified subdirectories and optional extra args.
 * @param src          Directory (or file) to match
 * @param dst          Directory (or file) to modify
 * @param subDirs      Sub-directories to rsync (null for all)
 * @throws IOException If anything goes wrong
 */
public void runRsync(File src,File dst,List<String> subDirs,String[] extraArgs) throws IOException {
  try {
    ArrayList<String> args=new ArrayList(6);
    args.add("String_Node_Str");
    args.add("String_Node_Str");
    args.add("String_Node_Str");
    if (extraArgs != null) {
      for (      String extra : extraArgs)       args.add(extra);
    }
    if (src.isDirectory())     args.add("String_Node_Str" + src.getAbsolutePath() + "String_Node_Str");
    if (subDirs != null) {
      args.add("String_Node_Str");
      for (      String subDir : subDirs) {
        if (new File(src.getAbsolutePath(),subDir).canRead())         args.add(src.getAbsolutePath() + "String_Node_Str" + subDir);
      }
    }
 else     args.add(src.getAbsolutePath() + (src.isDirectory() ? "String_Node_Str" : "String_Node_Str"));
    args.add(dst.getAbsolutePath() + (dst.isDirectory() ? "String_Node_Str" : "String_Node_Str"));
    String[] argArray=args.toArray(new String[args.size()]);
    ProcessRunner.runAndGrab(argArray,"String_Node_Str",0);
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
catch (  CommandFailedException e) {
    throw new IOException(e.getMessage());
  }
}
Program: 24661
Project: 24661
Buggy source:
private static void dumpFields(IndexReader indexReader,String[] fieldNames,boolean xmlMode,boolean allFieldsMode,Writer out) throws IOException {
  if (xmlMode) {
    out.write("String_Node_Str");
    out.write("String_Node_Str");
  }
  int maxDoc=indexReader.maxDoc();
  for (int i=0; i < maxDoc; i++) {
    if (indexReader.isDeleted(i))     continue;
    Document doc=indexReader.document(i);
    if (doc.getField("String_Node_Str") == null)     continue;
    ArrayList<Field> toPrint=new ArrayList();
    if (allFieldsMode) {
      for (      Field f : (List<Field>)doc.getFields()) {
        if (!f.name().matches("String_Node_Str"))         toPrint.add(f);
      }
    }
 else {
      for (int j=0; j < fieldNames.length; j++) {
        Field[] got=doc.getFields(fieldNames[j]);
        if (got != null)         toPrint.addAll(Arrays.asList(got));
      }
    }
    if (!toPrint.isEmpty()) {
      if (xmlMode)       dumpXmlRecord(toPrint,out);
 else       dumpDelimitedRecord(toPrint,out);
    }
  }
  if (xmlMode)   out.write("String_Node_Str");
}

Fixed version (ground truth):
private static void dumpFields(IndexReader indexReader,String[] fieldNames,boolean xmlMode,boolean allFieldsMode,Writer out) throws IOException {
  if (xmlMode) {
    out.write("String_Node_Str");
    out.write("String_Node_Str");
  }
  Field[] emptyFields=new Field[fieldNames.length];
  for (int j=0; j < fieldNames.length; j++)   emptyFields[j]=new Field(fieldNames[j],"String_Node_Str",Field.Store.YES,Field.Index.NO);
  int maxDoc=indexReader.maxDoc();
  for (int i=0; i < maxDoc; i++) {
    if (indexReader.isDeleted(i))     continue;
    Document doc=indexReader.document(i);
    if (doc.getField("String_Node_Str") == null)     continue;
    ArrayList<Field> toPrint=new ArrayList();
    if (allFieldsMode) {
      for (      Field f : (List<Field>)doc.getFields()) {
        if (!f.name().matches("String_Node_Str"))         toPrint.add(f);
      }
    }
 else {
      for (int j=0; j < fieldNames.length; j++) {
        Field[] got=doc.getFields(fieldNames[j]);
        if (got != null)         toPrint.addAll(Arrays.asList(got));
 else         toPrint.add(emptyFields[j]);
      }
    }
    if (!toPrint.isEmpty()) {
      if (xmlMode)       dumpXmlRecord(toPrint,out);
 else       dumpDelimitedRecord(toPrint,out);
    }
  }
  if (xmlMode)   out.write("String_Node_Str");
}
Program: 24662
Project: 24662
Buggy source:
private Entry scanForUpdates(){
synchronized (warmer) {
    for (    Entry ent : warmer.entries.values()) {
      if (ent.exception != null) {
        if (System.currentTimeMillis() - ent.exceptionTime < 5000)         continue;
        ent.exception=null;
      }
      if (ent.newPath.exists() && (ent.pendingPath.exists() || ent.sparePath.exists())) {
        if (ent.pendingPath.exists())         return ent;
      }
 else       if (ent.curSearcher != null) {
        try {
          if (!ent.curSearcher.isUpToDate())           return ent;
        }
 catch (        IOException e) {
          ent.exception=e;
          Trace.error(String.format("String_Node_Str",ent.indexPath,e.toString()));
        }
      }
    }
    return null;
  }
}

Fixed version (ground truth):
private Entry scanForUpdates(){
synchronized (warmer) {
    for (    Entry ent : warmer.entries.values()) {
      if (ent.exception != null) {
        if (System.currentTimeMillis() - ent.exceptionTime < 60000)         continue;
        ent.exception=null;
      }
      if (ent.newPath.exists() && (ent.pendingPath.exists() || ent.sparePath.exists())) {
        if (ent.pendingPath.exists())         return ent;
      }
 else       if (ent.curSearcher != null) {
        try {
          if (!ent.curSearcher.isUpToDate())           return ent;
        }
 catch (        IOException e) {
          ent.exception=e;
          ent.exceptionTime=System.currentTimeMillis();
          Trace.error(String.format("String_Node_Str",ent.indexPath,e.toString()));
        }
      }
    }
    return null;
  }
}
Program: 24663
Project: 24663
Buggy source:
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;
}

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;
    }
    if (pluralMap != null) {
      tmp=pluralMap.lookup(out);
      if (tmp != null)       out=tmp;
      recent.put(in,out);
    }
  }
  return out;
}
Program: 24664
Project: 24664
Buggy source:
/** 
 * Construct a word map by reading from an InputStream. If a non-null character map is specified, all entries are filtered through it.
 */
public WordMap(InputStream s,CharMap charMap) throws IOException {
  readFile(new BufferedReader(new InputStreamReader(s)),charMap);
}

Fixed version (ground truth):
/** 
 * Construct a word map by reading from an InputStream. If a non-null character map is specified, all entries are filtered through it.
 */
public WordMap(InputStream s,CharMap charMap) throws IOException {
  readFile(new BufferedReader(new InputStreamReader(s,"String_Node_Str")),charMap);
}
Program: 24665
Project: 24665
Buggy source:
/** 
 * Read in the list of fields that are tokenized in this index.
 */
public static LinkedHashSet readTokenizedFields(String indexPath,IndexReader indexReader) throws IOException {
  LinkedHashSet tokenizedFields=new LinkedHashSet();
  File tokFieldsFile=new File(Path.normalizePath(indexPath + "String_Node_Str"));
  if (tokFieldsFile.canRead()) {
    BufferedReader reader=new BufferedReader(new FileReader(tokFieldsFile));
    String line;
    while ((line=reader.readLine()) != null)     tokenizedFields.add(line);
    reader.close();
  }
  TermEnum tokTerms=indexReader.terms(new Term("String_Node_Str","String_Node_Str"));
  do {
    Term t=tokTerms.term();
    if (t == null)     break;
    if (!t.field().equals("String_Node_Str"))     break;
    tokenizedFields.add(t.text());
  }
 while (tokTerms.next());
  tokenizedFields.add("String_Node_Str");
  return tokenizedFields;
}

Fixed version (ground truth):
/** 
 * Read in the list of fields that are tokenized in this index.
 */
public static LinkedHashSet readTokenizedFields(String indexPath,IndexReader indexReader) throws IOException {
  LinkedHashSet tokenizedFields=new LinkedHashSet();
  File tokFieldsFile=new File(Path.normalizePath(indexPath + "String_Node_Str"));
  if (tokFieldsFile.canRead()) {
    BufferedReader reader=new BufferedReader(new FileReader(tokFieldsFile));
    String line;
    while ((line=reader.readLine()) != null)     tokenizedFields.add(line);
    reader.close();
  }
  TermEnum tokTerms=indexReader.terms(new Term("String_Node_Str","String_Node_Str"));
  do {
    Term t=tokTerms.term();
    if (t == null)     break;
    if (!t.field().equals("String_Node_Str"))     break;
    tokenizedFields.add(t.text());
  }
 while (tokTerms.next());
  tokenizedFields.add("String_Node_Str");
  tokenizedFields.add("String_Node_Str");
  return tokenizedFields;
}
Program: 24669
Project: 24669
Buggy source:
/** 
 * Read in the contents of a word file, forming blocks of 128 entries per block. The file need not be in sorted order.
 * @param reader  Reader to get the data from
 * @throws IOException
 */
private void readFile(BufferedReader reader) throws IOException {
}

Fixed version (ground truth):
/** 
 * Read in the contents of a word file, forming blocks of 128 entries per block. The file need not be in sorted order.
 * @param reader  Reader to get the data from
 * @param charMap Accent map to filter entries with, or null for none.
 * @throws IOException
 */
private void readFile(BufferedReader reader,CharMap charMap) throws IOException {
}
Program: 24670
Project: 24670
Buggy source:
/** 
 * Construct a word map by reading from an InputStream. 
 */
public WordMap(InputStream s) throws IOException {
  readFile(new BufferedReader(new InputStreamReader(s)));
}

Fixed version (ground truth):
/** 
 * Construct a word map by reading from an InputStream. If a non-null character map is specified, all entries are filtered through it.
 */
public WordMap(InputStream s,CharMap charMap) throws IOException {
  readFile(new BufferedReader(new InputStreamReader(s)),charMap);
}
Program: 24676
Project: 24676
Buggy source:
/** 
 * Retrieve the next token in the stream. 
 */
public Token next() throws IOException {
  Token t;
  if (nextToken != null) {
    t=nextToken;
    nextToken=null;
  }
 else {
    if (pos > str.length())     return null;
    pos=str.indexOf("String_Node_Str",pos);
    if (pos < 0)     pos=str.length();
    String term=str.substring(0,pos);
    t=new Token(term,0,pos);
    pos+=2;
    String lcTerm=term.toLowerCase();
    if (!lcTerm.equals(term))     nextToken=new Token(lcTerm,0,pos);
  }
  return t;
}

Fixed version (ground truth):
/** 
 * Retrieve the next token in the stream. 
 */
public Token next() throws IOException {
  Token t;
  if (nextToken != null) {
    t=nextToken;
    nextToken=null;
  }
 else {
    if (pos > str.length())     return null;
    pos=str.indexOf("String_Node_Str",pos);
    if (pos < 0)     pos=str.length();
    String term=str.substring(0,pos);
    term=term.replace("String_Node_Str","String_Node_Str");
    term=term.replace("String_Node_Str","String_Node_Str");
    term=term.replace("String_Node_Str","String_Node_Str");
    t=new Token(term,0,pos);
    pos+=2;
    String lcTerm=term.toLowerCase();
    if (!lcTerm.equals(term))     nextToken=new Token(lcTerm,0,pos);
  }
  return t;
}
Program: 24677
Project: 24677
Buggy source:
/** 
 * Does the work of turning faceted groups into XML.
 * @param group   The group to work on
 * @param buf     Buffer to add XML to
 */
private void structureGroup(ResultGroup group,StringBuffer buf){
  buf.append("String_Node_Str" + group.value.replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str"+ "String_Node_Str"+ (group.rank + 1)+ "String_Node_Str"+ "String_Node_Str"+ group.totalSubGroups+ "String_Node_Str"+ "String_Node_Str"+ group.totalDocs+ "String_Node_Str"+ "String_Node_Str"+ (group.endDoc > 0 ? group.startDoc + 1 : 0)+ "String_Node_Str"+ "String_Node_Str"+ (group.endDoc)+ "String_Node_Str");
  if (group.docHits != null)   structureDocHits(group.docHits,group.startDoc,buf);
  if (group.subGroups != null) {
    for (int i=0; i < group.subGroups.length; i++)     structureGroup(group.subGroups[i],buf);
  }
  buf.append("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Does the work of turning faceted groups into XML.
 * @param group   The group to work on
 * @param buf     Buffer to add XML to
 */
private void structureGroup(ResultGroup group,StringBuffer buf){
  buf.append("String_Node_Str" + TextServlet.makeHtmlString(group.value) + "String_Node_Str"+ "String_Node_Str"+ (group.rank + 1)+ "String_Node_Str"+ "String_Node_Str"+ group.totalSubGroups+ "String_Node_Str"+ "String_Node_Str"+ group.totalDocs+ "String_Node_Str"+ "String_Node_Str"+ (group.endDoc > 0 ? group.startDoc + 1 : 0)+ "String_Node_Str"+ "String_Node_Str"+ (group.endDoc)+ "String_Node_Str");
  if (group.docHits != null)   structureDocHits(group.docHits,group.startDoc,buf);
  if (group.subGroups != null) {
    for (int i=0; i < group.subGroups.length; i++)     structureGroup(group.subGroups[i],buf);
  }
  buf.append("String_Node_Str");
}
Program: 24678
Project: 24678
Buggy source:
/** 
 * Determines if the given string is an bi-gram of a real word with a stop-word.
 * @param stopWords   The set of stop-words
 * @param str         The string to check
 * @return            true if it's an bi-gram
 */
public static boolean isBigram(Set stopWords,String str){
}

Fixed version (ground truth):
/** 
 * Determines if the given string is an bi-gram of a real word with a stop-word.
 * @param stopWords   The set of stop-words
 * @param str         The string to check
 * @return            true if it's an bi-gram
 */
public static boolean isBigram(Set stopWords,String str){
  int pos=str.indexOf('~');
  if (pos < 0)   return false;
  if (!(pos > 0 && pos < str.length() - 1))   return false;
  String before=str.substring(0,pos);
  String after=str.substring(pos + 1);
  if (!stopWords.contains(before) || stopWords.contains(after))   return false;
  return true;
}
Program: 24680
Project: 24680
Buggy source:
/** 
 * Determines if the given string is an bi-gram of a real word with a stop-word.
 * @param stopWords   The set of stop-words
 * @param str         The string to check
 * @return            true if it's an bi-gram
 */
public static boolean isBigram(Set stopWords,String str){
  int pos=str.indexOf('~');
  if (pos < 0)   return false;
  if (!(pos > 0 && pos < str.length() - 1))   return false;
  String before=str.substring(0,pos);
  String after=str.substring(pos + 1);
  if (!stopWords.contains(before) || stopWords.contains(after))   return false;
  return true;
}

Fixed version (ground truth):
/** 
 * Determines if the given string is an bi-gram of a real word with a stop-word.
 * @param stopWords   The set of stop-words
 * @param str         The string to check
 * @return            true if it's an bi-gram
 */
public static boolean isBigram(Set stopWords,String str){
  int pos=str.indexOf('~');
  if (pos < 0)   return false;
  if (pos < 0 || pos >= str.length() - 1)   return false;
  String before=str.substring(0,pos);
  String after=str.substring(pos + 1);
  if (!stopWords.contains(before) && !stopWords.contains(after))   return false;
  return true;
}
Program: 24681
Project: 24681
Buggy source:
private void addParam(String name,String val){
  ArrayList<String> vals=params.get(name);
  if (vals == null) {
    vals=new ArrayList<String>();
    params.put(name,vals);
  }
  vals.add(val);
}

Fixed version (ground truth):
private void addParam(String name,String val){
  ArrayList<String> vals=params.get(name);
  if (vals == null) {
    paramNames.add(name);
    vals=new ArrayList<String>();
    params.put(name,vals);
  }
  vals.add(val);
}
Program: 24683
Project: 24683
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");
  url=decodeURL(url);
  url=convertUTF8inURL(url);
  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.
 * @param raw true to suppress un-escaping of % codes and probableutf-8 coding in the URL.
 */
public static String getRequestURL(HttpServletRequest req,boolean raw){
  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");
  if (!raw) {
    url=decodeURL(url);
    url=convertUTF8inURL(url);
  }
  return url;
}
Program: 24685
Project: 24685
Buggy source:
/** 
 * Create a QueryProcessor. Checks the system property "org.cdlib.xtf.QueryProcessorClass" to see if there is a user- supplied implementation. If not, a   {@link DefaultQueryProcessor} iscreated.
 */
public QueryProcessor createQueryProcessor(){
  final String propName="String_Node_Str";
  String className=System.getProperty(propName);
  Class theClass=DefaultQueryProcessor.class;
  try {
    if (className != null)     theClass=Class.forName(className);
    QueryProcessor processor=(QueryProcessor)theClass.newInstance();
    IndexWarmer warmer=null;
synchronized (indexWarmers) {
      String xtfHome=Path.normalizePath(TextServlet.getCurServlet().getRealPath("String_Node_Str"));
      warmer=indexWarmers.get(xtfHome);
      if (warmer == null) {
        warmer=new IndexWarmer(xtfHome,5);
        indexWarmers.put(xtfHome,warmer);
      }
    }
    processor.setIndexWarmer(warmer);
    return processor;
  }
 catch (  ClassCastException e) {
    Trace.error("String_Node_Str" + className + "String_Node_Str"+ "String_Node_Str"+ propName+ "String_Node_Str"+ QueryProcessor.class.getName());
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    Trace.error("String_Node_Str" + className + "String_Node_Str"+ propName+ "String_Node_Str");
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Create a QueryProcessor. Checks the system property "org.cdlib.xtf.QueryProcessorClass" to see if there is a user- supplied implementation. If not, a   {@link DefaultQueryProcessor} iscreated.
 */
public QueryProcessor createQueryProcessor(){
  final String propName="String_Node_Str";
  String className=System.getProperty(propName);
  Class theClass=DefaultQueryProcessor.class;
  try {
    if (className != null)     theClass=Class.forName(className);
    QueryProcessor processor=(QueryProcessor)theClass.newInstance();
    IndexWarmer warmer=null;
synchronized (indexWarmers) {
      String xtfHome=Path.normalizePath(TextServlet.getCurServlet().getRealPath("String_Node_Str"));
      warmer=indexWarmers.get(xtfHome);
      if (warmer == null) {
        warmer=new IndexWarmer(xtfHome,60);
        indexWarmers.put(xtfHome,warmer);
      }
    }
    processor.setIndexWarmer(warmer);
    return processor;
  }
 catch (  ClassCastException e) {
    Trace.error("String_Node_Str" + className + "String_Node_Str"+ "String_Node_Str"+ propName+ "String_Node_Str"+ QueryProcessor.class.getName());
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    Trace.error("String_Node_Str" + className + "String_Node_Str"+ propName+ "String_Node_Str");
    throw new RuntimeException(e);
  }
}
Program: 24686
Project: 24686
Buggy source:
@Override public Enumeration getParameterNames(){
  init();
  Set keys=params.keySet();
  ArrayList<String> keyColl=new ArrayList<String>(keys);
  Collections.sort(keyColl);
  final Iterator iter=keyColl.iterator();
  return new Enumeration(){
    public boolean hasMoreElements(){
      return iter.hasNext();
    }
    public Object nextElement(){
      return iter.next();
    }
  }
;
}

Fixed version (ground truth):
@Override public Enumeration getParameterNames(){
  init();
  final Iterator iter=paramNames.iterator();
  return new Enumeration(){
    public boolean hasMoreElements(){
      return iter.hasNext();
    }
    public Object nextElement(){
      return iter.next();
    }
  }
;
}
Program: 24690
Project: 24690
Buggy source:
/** 
 * Create a QueryProcessor. Checks the system property "org.cdlib.xtf.QueryProcessorClass" to see if there is a user- supplied implementation. If not, a   {@link DefaultQueryProcessor} iscreated.
 */
public static QueryProcessor createQueryProcessor(){
  final String propName="String_Node_Str";
  String className=System.getProperty(propName);
  Class theClass=DefaultQueryProcessor.class;
  try {
    if (className != null)     theClass=Class.forName(className);
    QueryProcessor processor=(QueryProcessor)theClass.newInstance();
    if (indexWarmer == null) {
      indexWarmer=new IndexWarmer(Path.normalizePath(TextServlet.getCurServlet().getRealPath("String_Node_Str")),5);
      DefaultQueryProcessor.setIndexWarmer(indexWarmer);
    }
    return processor;
  }
 catch (  ClassCastException e) {
    Trace.error("String_Node_Str" + className + "String_Node_Str"+ "String_Node_Str"+ propName+ "String_Node_Str"+ QueryProcessor.class.getName());
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    Trace.error("String_Node_Str" + className + "String_Node_Str"+ propName+ "String_Node_Str");
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Create a QueryProcessor. Checks the system property "org.cdlib.xtf.QueryProcessorClass" to see if there is a user- supplied implementation. If not, a   {@link DefaultQueryProcessor} iscreated.
 */
public QueryProcessor createQueryProcessor(){
  final String propName="String_Node_Str";
  String className=System.getProperty(propName);
  Class theClass=DefaultQueryProcessor.class;
  try {
    if (className != null)     theClass=Class.forName(className);
    QueryProcessor processor=(QueryProcessor)theClass.newInstance();
    IndexWarmer warmer=null;
synchronized (indexWarmers) {
      String xtfHome=Path.normalizePath(TextServlet.getCurServlet().getRealPath("String_Node_Str"));
      warmer=indexWarmers.get(xtfHome);
      if (warmer == null) {
        warmer=new IndexWarmer(xtfHome,5);
        indexWarmers.put(xtfHome,warmer);
      }
    }
    processor.setIndexWarmer(warmer);
    return processor;
  }
 catch (  ClassCastException e) {
    Trace.error("String_Node_Str" + className + "String_Node_Str"+ "String_Node_Str"+ propName+ "String_Node_Str"+ QueryProcessor.class.getName());
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    Trace.error("String_Node_Str" + className + "String_Node_Str"+ propName+ "String_Node_Str");
    throw new RuntimeException(e);
  }
}
Program: 24691
Project: 24691
Buggy source:
/** 
 * Constructs and loads an IP map from the specified file.
 * @param path          Path to the file to load the IP map from.
 * @exception IOException   If the IP map file couldn't be opened.
 */
public IpList(String path) throws IOException {
  map=new TreeMap(new IpRangeComparator());
  readMap(path);
}

Fixed version (ground truth):
/** 
 * Constructs and loads an IP map from the specified file.
 * @param path          Path to the file to load the IP map from.
 * @exception IOException   If the IP map file couldn't be opened.
 */
public IpList(String path) throws IOException {
  ranges=new ArrayList<IpRange>();
  readRanges(path);
}
Program: 24692
Project: 24692
Buggy source:
/** 
 * Parses the given IP address and checks whether it falls within one of the positive ranges of the map, and doesn't fall in one of the excluded ranges.
 * @param ipAddrStr     A string of the form "a.b.c.d" where each componentis a decimal number from 0-255.
 * @return              true if and only if the address matches.
 */
public boolean isApproved(String ipAddrStr){
  IpAddr parsedAddr=new IpAddr();
  if (parsedAddr.parse(ipAddrStr) == null)   return false;
  Iterator i=map.tailMap(parsedAddr).keySet().iterator();
  boolean positive=false;
  boolean negative=false;
  while (i.hasNext()) {
    IpRange mapRange=(IpRange)i.next();
    if (!mapRange.matches(parsedAddr) && !mapRange.startAddr.componentsEqual(parsedAddr,2)) {
      break;
    }
    if (!mapRange.matches(parsedAddr))     continue;
    if (mapRange.isPositive)     positive=true;
 else     negative=true;
  }
  if (negative)   return false;
  if (positive)   return true;
  return false;
}

Fixed version (ground truth):
/** 
 * Parses the given IP address and checks whether it falls within one of the positive ranges of the map, and doesn't fall in one of the excluded ranges.
 * @param ipAddrStr     A string of the form "a.b.c.d" where each componentis a decimal number from 0-255.
 * @return              true if and only if the address matches.
 */
public boolean isApproved(String ipAddrStr){
  IpAddr parsedAddr=new IpAddr();
  if (parsedAddr.parse(ipAddrStr) == null)   return false;
  boolean positive=false;
  boolean negative=false;
  for (  IpRange range : ranges) {
    if (!range.matches(parsedAddr))     continue;
    if (range.isPositive)     positive=true;
 else     negative=true;
  }
  if (negative)   return false;
  if (positive)   return true;
  return false;
}
Program: 24693
Project: 24693
Buggy source:
/** 
 * Used by readMap to parse a single entry in the IP map file.
 * @param line          The line of text to parse
 * @param isPositive    true if this is an "exclude" line
 */
private void processEntry(String line,boolean isPositive){
  IpAddr startIp=new IpAddr();
  IpAddr endIp=new IpAddr();
  String str=line;
  str=startIp.parse(str);
  if (str == null)   return;
  str=str.trim();
  if (str.startsWith("String_Node_Str")) {
    str=str.substring(1).trim();
    str=endIp.parse(str);
    if (str == null)     return;
  }
 else   endIp=startIp;
  IpRange range=new IpRange(startIp,endIp,isPositive);
  map.put(range,null);
}

Fixed version (ground truth):
/** 
 * Used by readMap to parse a single entry in the IP map file.
 * @param line          The line of text to parse
 * @param isPositive    true if this is an "exclude" line
 */
private void processEntry(String line,boolean isPositive){
  IpAddr startIp=new IpAddr();
  IpAddr endIp=new IpAddr();
  String str=line;
  str=startIp.parse(str);
  if (str == null)   return;
  str=str.trim();
  if (str.startsWith("String_Node_Str")) {
    str=str.substring(1).trim();
    str=endIp.parse(str);
    if (str == null)     return;
  }
 else   endIp=startIp;
  IpRange range=new IpRange(startIp,endIp,isPositive);
  ranges.add(range);
}
Program: 24694
Project: 24694
Buggy source:
/** 
 * Checks if a specified IP address falls within the range. 
 */
boolean matches(IpAddr addr){
  for (int i=0; i < 4; i++) {
    int min=startAddr.components[i];
    int max=endAddr.components[i];
    if (min > max) {
      int tmp=min;
      min=max;
      max=tmp;
    }
    if (min == 999)     continue;
    if (addr.components[i] < min)     return false;
    if (addr.components[i] > max)     return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks if a specified IP address falls within the range. 
 */
boolean matches(IpAddr addr){
  for (int i=0; i < 4; i++) {
    int ic=addr.components[i];
    int sc=startAddr.components[i];
    if (sc == 999)     sc=0;
    if (ic < sc)     return false;
    if (ic > sc)     break;
  }
  for (int i=0; i < 4; i++) {
    int ic=addr.components[i];
    int ec=endAddr.components[i];
    if (ec == 999)     ec=255;
    if (ic > ec)     return false;
    if (ic < ec)     break;
  }
  return true;
}
Program: 24695
Project: 24695
Buggy source:
/** 
 * Utility function to delete a specified directory and all its files and subdirectories. <br><br>
 * @return <code>true</code> - Directory and associated files and sub-directories successfully deleted. <br> <code>false</code> - Error deleting specified directory or one of its files or sub-directories. <br><br>
 */
public static boolean deleteDir(File dir){
  if (dir.isDirectory()) {
    String[] children=dir.list();
    for (int i=0; i < children.length; i++) {
      boolean success=deleteDir(new File(dir,children[i]));
      if (!success)       return false;
    }
  }
  return dir.delete();
}

Fixed version (ground truth):
/** 
 * Utility function to delete a specified directory and all its files and subdirectories. <br><br>
 * @return <code>true</code> - Directory and associated files and sub-directories successfully deleted. <br> <code>false</code> - Error deleting specified directory or one of its files or sub-directories. <br><br>
 */
public static void deleteDir(File dir) throws IOException {
  if (dir.isDirectory()) {
    String[] children=dir.list();
    for (int i=0; i < children.length; i++)     deleteDir(new File(dir,children[i]));
  }
  if (!dir.delete()) {
    throw new IOException("String_Node_Str" + dir.toString() + "String_Node_Str");
  }
}
Program: 24696
Project: 24696
Buggy source:
/** 
 * Makes a Saxon Receiver that will transparently add a session IDs to URLs if they match the servlet URL, or other patterns configured in the conf file.
 * @param trans   The transformer that will do the work
 * @param req     The servlet request being processed
 * @param res     The servlet response to output to
 * @return        A Receiver suitable for the target of the transform
 */
public Receiver createFilteredReceiver(Transformer trans,HttpServletRequest req,HttpServletResponse res) throws XPathException, IOException {
  StreamResult stream=new StreamResult(res.getOutputStream());
  Controller controller=(Controller)trans;
  SerializerFactory factory=controller.getConfiguration().getSerializerFactory();
  Receiver target=factory.getReceiver(stream,controller.makePipelineConfiguration(),trans.getOutputProperties());
  TextConfig config=getConfig();
  if (config.trackSessions && config.sessionEncodeURLPattern != null)   return new SessionURLRewriter(target,config.sessionEncodeURLPattern,req,res);
 else   return target;
}

Fixed version (ground truth):
/** 
 * Makes a Saxon Receiver that will transparently add a session IDs to URLs if they match the servlet URL, or other patterns configured in the conf file.
 * @param trans   The transformer that will do the work
 * @param req     The servlet request being processed
 * @param res     The servlet response to output to
 * @return        A Receiver suitable for the target of the transform
 */
public Result createFilteredReceiver(Transformer trans,HttpServletRequest req,HttpServletResponse res) throws XPathException, IOException {
  StreamResult stream=new StreamResult(res.getOutputStream());
  TextConfig config=getConfig();
  if (config.trackSessions && config.sessionEncodeURLPattern != null) {
    Controller controller=(Controller)trans;
    SerializerFactory factory=controller.getConfiguration().getSerializerFactory();
    Receiver target=factory.getReceiver(stream,controller.makePipelineConfiguration(),trans.getOutputProperties());
    return new SessionURLRewriter(target,config.sessionEncodeURLPattern,req,res);
  }
 else {
    return stream;
  }
}
Program: 24697
Project: 24697
Buggy source:
/** 
 * Performs user authentication for a request, given the authentication info for the document. In the case of testing, we never fail authentication.
 */
protected boolean authenticate(LinkedList docKey,DocRequest docInfo,HttpServletRequest req,HttpServletResponse res) throws Exception {
  return true;
}

Fixed version (ground truth):
/** 
 * Performs user authentication for a request, given the authentication info for the document. In the case of testing, we never fail authentication.
 */
@Override protected boolean authenticate(DocRequest docReq,HttpServletRequest req,HttpServletResponse res) throws Exception {
  return true;
}
Program: 24698
Project: 24698
Buggy source:
/** 
 * Does the work of locating and loading the source document. Handles fetching a file from a URL, lazy file, or a plain XML file on disk. Also fires up a text query if requested.
 * @param docInfo       Tells which document to load, the query toapply, tec.
 * @param transformer   The XSLT transformer that will be used on thedocument.
 * @return              An XML Source object representing the loadeddocument.
 * @throws IOException  If a problem is encountered loading a file or URL
 * @throws SAXException If the document cannot be parsed as valid XML
 * @throws ParserConfigurationException Miscellaneous configurationproblems
 */
protected Source getSourceDoc(DocRequest docInfo,Transformer transformer) throws IOException, SAXException, ParserConfigurationException {
  forceLazy=true;
  if (!useAnnotated) {
    Source realSrc=super.getSourceDoc(docInfo,transformer);
    if (dump)     dumpTree("String_Node_Str",realSrc);
    return realSrc;
  }
  Controller c=(Controller)transformer;
  Executable e=c.getExecutable();
  KeyManager k=e.getKeyManager();
  if (k instanceof LazyKeyManager)   e.setKeyManager(new KeyManager(c.getConfiguration()));
  e.setStripsWhitespace(false);
  try {
    Source src=getAnnotatedTree(docInfo.source);
    if (dump)     dumpTree("String_Node_Str",src);
    return src;
  }
 catch (  TransformerException ex) {
    throw new RuntimeException(ex);
  }
}

Fixed version (ground truth):
/** 
 * Does the work of locating and loading the source document. Handles fetching a file from a URL, lazy file, or a plain XML file on disk. Also fires up a text query if requested.
 * @param docReq       Tells which document to load, the query toapply, tec.
 * @param transformer   The XSLT transformer that will be used on thedocument.
 * @return              An XML Source object representing the loadeddocument.
 * @throws IOException  If a problem is encountered loading a file or URL
 * @throws SAXException If the document cannot be parsed as valid XML
 * @throws ParserConfigurationException Miscellaneous configurationproblems
 */
protected Source getSourceDoc(DocRequest docReq,Transformer transformer) throws IOException, SAXException, ParserConfigurationException {
  forceLazy=true;
  if (!useAnnotated) {
    Source realSrc=super.getSourceDoc(docReq,transformer);
    if (dump)     dumpTree("String_Node_Str",realSrc);
    return realSrc;
  }
  Controller c=(Controller)transformer;
  Executable e=c.getExecutable();
  KeyManager k=e.getKeyManager();
  if (k instanceof LazyKeyManager)   e.setKeyManager(new KeyManager(c.getConfiguration()));
  e.setStripsWhitespace(false);
  try {
    Source src=getAnnotatedTree(docReq.source);
    if (dump)     dumpTree("String_Node_Str",src);
    return src;
  }
 catch (  TransformerException ex) {
    throw new RuntimeException(ex);
  }
}
Program: 24699
Project: 24699
Buggy source:
/** 
 * Mark terms up to (but not including) 'wordPos' 
 */
private void markTerms(WordIter iter,int fromPos,int toPos,boolean markStopWords){
  if (terms == null)   return;
  iter.seekFirst(fromPos,true);
  while (true) {
    if (tmpPos == null)     tmpPos=iter.getPos(WordIter.TERM_START);
 else     iter.getPos(tmpPos,WordIter.TERM_START);
    if (tmpPos.wordPos() < fromPos)     break;
    if (tmpPos.wordPos() >= toPos)     break;
    String term=iter.term();
    if (terms.contains(term)) {
      if (markStopWords || stopSet == null || !stopSet.contains(term)) {
        collector.term((MarkPos)tmpPos.clone(),iter.getPos(WordIter.TERM_END),term);
      }
    }
    if (!iter.next(true))     break;
  }
  if (toPos < Integer.MAX_VALUE)   iter.seekLast(toPos - 1,true);
  termsMarkedPos=toPos;
}

Fixed version (ground truth):
/** 
 * Mark terms up to (but not including) 'wordPos' 
 */
private void markTerms(WordIter iter,int fromPos,int toPos,boolean markStopWords){
  if (terms == null)   return;
  if (fromPos == toPos)   return;
  iter.seekFirst(fromPos,true);
  while (true) {
    if (tmpPos == null)     tmpPos=iter.getPos(WordIter.TERM_START);
 else     iter.getPos(tmpPos,WordIter.TERM_START);
    if (tmpPos.wordPos() < fromPos)     break;
    if (tmpPos.wordPos() >= toPos)     break;
    String term=iter.term();
    if (terms.contains(term)) {
      if (markStopWords || stopSet == null || !stopSet.contains(term)) {
        collector.term((MarkPos)tmpPos.clone(),iter.getPos(WordIter.TERM_END),term);
      }
    }
    if (!iter.next(true))     break;
  }
  if (toPos < Integer.MAX_VALUE)   iter.seekLast(toPos - 1,true);
  termsMarkedPos=toPos;
}
Program: 24701
Project: 24701
Buggy source:
/** 
 * Re-sort the hierarchy according to the facet spec, and store the new child/sibling relationships.
 */
private void sortGroups(){
  int sortKind;
  if (spec.sortGroupsBy.equals("String_Node_Str"))   sortKind=SORT_BY_VALUE;
 else   if (spec.sortGroupsBy.equals("String_Node_Str"))   sortKind=SORT_BY_TOTAL_DOCS;
 else   if (spec.sortGroupsBy.equals("String_Node_Str"))   sortKind=SORT_BY_MAX_DOC_SCORE;
 else   throw new RuntimeException("String_Node_Str" + spec.sortGroupsBy);
  if (!data.isDynamic() && sortKind == SORT_BY_VALUE)   return;
  sortedChild=new int[data.nGroups()];
  sortedSibling=new int[data.nGroups()];
  Arrays.fill(sortedChild,-1);
  Arrays.fill(sortedSibling,-1);
  sortChildren(0,sortKind);
}

Fixed version (ground truth):
/** 
 * Re-sort the hierarchy according to the facet spec, and store the new child/sibling relationships.
 */
private void sortGroups(){
}
Program: 24703
Project: 24703
Buggy source:
/** 
 * Handles the HTTP 'get' method. Based on the HTTP request, produces an appropriate response.
 * @param req            The HTTP request
 * @param res            The HTTP response
 * @exception IOException    If unable to write the output stream.
 */
public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException {
  try {
    String source=req.getParameter("String_Node_Str");
    stylesheetCache.enableProfiling(config.stylesheetProfiling);
    res.setContentType("String_Node_Str");
    Trace.debug("String_Node_Str" + getRequestURL(req));
    StringTokenizer st=new StringTokenizer(config.docLookupParams,"String_Node_Str");
    LinkedList docKey=new LinkedList();
    while (st.hasMoreTokens()) {
      String name=st.nextToken();
      String value=req.getParameter(name);
      if (value != null) {
        docKey.add(name);
        docKey.add(convertUTF8inURL(value));
      }
    }
    DocInfo docInfo=docLookupCache.find(docKey);
    if (!isEmpty(source) && source.startsWith("String_Node_Str")) {
      docInfo=new DocInfo(docInfo);
      docInfo.source=source;
    }
 else {
      File docFile=new File(docInfo.source);
      if (!docFile.canRead())       throw new InvalidDocumentException();
    }
    if (!authenticate(docKey,docInfo,req,res))     return;
    apply(docInfo,req,res);
  }
 catch (  Exception e) {
    if (!(e instanceof RedirectException)) {
      try {
        genErrorPage(req,res,e);
      }
 catch (      RedirectException re) {
      }
    }
    return;
  }
}

Fixed version (ground truth):
/** 
 * Handles the HTTP 'get' method. Based on the HTTP request, produces an appropriate response.
 * @param req            The HTTP request
 * @param res            The HTTP response
 * @exception IOException    If unable to write the output stream.
 */
public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException {
  try {
    String source=req.getParameter("String_Node_Str");
    stylesheetCache.enableProfiling(config.stylesheetProfiling);
    res.setContentType("String_Node_Str");
    Trace.debug("String_Node_Str" + getRequestURL(req));
    StringTokenizer st=new StringTokenizer(config.docLookupParams,"String_Node_Str");
    LinkedList docKey=new LinkedList();
    while (st.hasMoreTokens()) {
      String name=st.nextToken();
      String value=req.getParameter(name);
      if (value != null) {
        docKey.add(name);
        docKey.add(convertUTF8inURL(value));
      }
    }
    DocInfo docInfo=docLookupCache.find(docKey);
    if (!isEmpty(source) && source.startsWith("String_Node_Str")) {
      docInfo=new DocInfo(docInfo);
      docInfo.source=source;
    }
 else {
      File docFile=new File(docInfo.source);
      if (!docFile.canRead())       throw new InvalidDocumentException();
    }
    if (!authenticate(docKey,docInfo,req,res))     return;
    apply(docInfo,req,res);
  }
 catch (  Exception e) {
    if (!(e instanceof RedirectException) && !(e instanceof SocketException)) {
      try {
        genErrorPage(req,res,e);
      }
 catch (      RedirectException re) {
      }
    }
    return;
  }
}
Program: 24704
Project: 24704
Buggy source:
/** 
 * Construct an Attribute node for the n'th attribute of a given element
 * @param element The element containing the relevant attribute
 * @param index The index position of the attribute starting at zero
 */
public AttributeImpl(ElementImpl element,int index){
  this.index=index;
  this.element=element;
  nameCode=element.attrNames[index];
}

Fixed version (ground truth):
/** 
 * Construct an Attribute node for the n'th attribute of a given element
 * @param element The element containing the relevant attribute
 * @param index The index position of the attribute starting at zero
 */
public AttributeImpl(ElementImpl element,int index){
  this.document=element.document;
  this.index=index;
  this.element=element;
  nameCode=element.attrNames[index];
}
Program: 24705
Project: 24705
Buggy source:
/** 
 * Adds the top-level &lt;xtf:snippets&gt; element. If its children are fetched later, they'll be created on the fly.
 */
private void addSnippets(){
  ElementImpl rootKid=(ElementImpl)getNode(1);
  topSnippetNode=addElement(rootKid,snippetsElementCode,2,true);
  topSnippetNode.setAttribute(0,totalHitCountAttrCode,(docHit != null) ? Integer.toString(docHit.totalSnippets()) : "String_Node_Str");
  topSnippetNode.setAttribute(1,hitCountAttrCode,Integer.toString(nHits));
  if (nHits > 0)   topSnippetNode.childNum=SNIPPET_MARKER + 0;
}

Fixed version (ground truth):
/** 
 * Adds the top-level &lt;xtf:snippets&gt; element. If its children are fetched later, they'll be created on the fly.
 */
private void addSnippets(){
  ElementImpl rootKid=getRootKid();
  topSnippetNode=addElement(rootKid,snippetsElementCode,2,true);
  topSnippetNode.setAttribute(0,totalHitCountAttrCode,(docHit != null) ? Integer.toString(docHit.totalSnippets()) : "String_Node_Str");
  topSnippetNode.setAttribute(1,hitCountAttrCode,Integer.toString(nHits));
  if (nHits > 0)   topSnippetNode.childNum=SNIPPET_MARKER + 0;
}
Program: 24706
Project: 24706
Buggy source:
/** 
 * Add a value to the end of the list, expanding the array if necessary 
 */
public final void add(long value){
  if (size == data.length)   resize(size * 3 / 2);
  data[size++]=value;
}

Fixed version (ground truth):
/** 
 * Add a value to the end of the list, expanding the array if necessary 
 */
public final void add(long value){
  if (size == data.length)   resize(Math.max(size + 5,size * 3 / 2));
  data[size++]=value;
}