Program: 24667
Project: 24667
Buggy source:
/** 
 * Open a TextIndexer (Lucene) index for reading or writing. <br><br> The primary purpose of this method is to open the index identified by the <code>cfgInfo</code> for reading and searching. Index reading and searching operations are used to clean, cull, or optimize an index. Opening an index for writing is performed by the method  {@link XMLTextProcessor#openIdxForWriting() openIdxForWriting()}only when the index is being updated with new document information. <br><br>
 * @param homePath Path from which to resolve relative path names.<br>
 * @param idxInfo  A config structure containing information about the indexto open. <br>
 * @param clean    true to truncate any existing index; false to add to it.<br><br>
 * @param ignoreFileTimes true to ignore file time checks (only appliesduring incremental indexing).
 * @.notes This method will create an index if it doesn't exist, or truncate an index that does exist if the <code>clean</code> flag is set in the <code>cfgInfo</code> structure. <br><br> This method makes a private internal reference {@link XMLTextProcessor#indexInfo indexInfo}to the passed configuration structure for use by other methods in this class. <br><br>
 * @throws IOException  Any I/O exceptions that occurred during the opening,creation, or truncation of the Lucene index. <br><br>
 */
public void open(String homePath,IndexInfo idxInfo,boolean clean,boolean ignoreFileTimes) throws IOException {
  fileQueue=new LinkedList();
  try {
    this.indexInfo=idxInfo;
    this.xtfHomePath=homePath;
    this.ignoreFileTimes=ignoreFileTimes;
    indexPath=getIndexPath();
    if (indexInfo.stopWords != null)     stopSet=BigramStopFilter.makeStopSet(indexInfo.stopWords);
    if (clean) {
      Path.createPath(indexPath);
      createIndex(indexInfo);
    }
 else {
      Path.createPath(indexPath);
      FSDirectory idxDir=NativeFSDirectory.getDirectory(indexPath);
      if (!IndexReader.indexExists(idxDir))       createIndex(indexInfo);
    }
    openIdxForReading();
    Hits match=indexSearcher.search(new TermQuery(new Term("String_Node_Str","String_Node_Str")));
    if (match.length() == 0)     throw new RuntimeException("String_Node_Str");
    Document doc=match.doc(0);
    String indexVersion=doc.get("String_Node_Str");
    if (indexVersion == null)     indexVersion="String_Node_Str";
    if (indexVersion.compareTo(TextIndexer.REQUIRED_VERSION) < 0) {
      throw new RuntimeException("String_Node_Str" + indexVersion + "String_Node_Str"+ TextIndexer.REQUIRED_VERSION+ "String_Node_Str");
    }
    if (Integer.parseInt(doc.get("String_Node_Str")) != indexInfo.getChunkSize()) {
      throw new RuntimeException("String_Node_Str" + doc.get("String_Node_Str") + "String_Node_Str"+ indexInfo.getChunkSize()+ "String_Node_Str");
    }
    if (Integer.parseInt(doc.get("String_Node_Str")) != indexInfo.getChunkOvlp()) {
      throw new RuntimeException("String_Node_Str" + doc.get("String_Node_Str") + "String_Node_Str"+ indexInfo.getChunkOvlp()+ "String_Node_Str");
    }
    String stopWords=indexInfo.stopWords;
    if (stopWords == null)     stopWords="String_Node_Str";
    if (!doc.get("String_Node_Str").equals(stopWords)) {
      throw new RuntimeException("String_Node_Str" + doc.get("String_Node_Str") + "String_Node_Str"+ indexInfo.stopWords+ "String_Node_Str");
    }
    String pluralMapName=doc.get("String_Node_Str");
    if (pluralMapName != null && pluralMapName.length() > 0) {
      File pluralMapFile=new File(Path.normalizePath(indexPath + pluralMapName));
      InputStream stream=new FileInputStream(pluralMapFile);
      if (pluralMapName.endsWith("String_Node_Str"))       stream=new GZIPInputStream(stream);
      pluralMap=new WordMap(stream);
    }
    String accentMapName=doc.get("String_Node_Str");
    if (accentMapName != null && accentMapName.length() > 0) {
      File accentMapFile=new File(Path.normalizePath(indexPath + accentMapName));
      InputStream stream=new FileInputStream(accentMapFile);
      if (accentMapName.endsWith("String_Node_Str"))       stream=new GZIPInputStream(stream);
      accentMap=new CharMap(stream);
    }
    tokenizedFields=XtfSearcher.readTokenizedFields(indexPath,indexReader);
  }
 catch (  IOException e) {
    Trace.tab();
    Trace.error("String_Node_Str" + e);
    Trace.untab();
    close();
    throw e;
  }
}

Fixed version (ground truth):
/** 
 * Open a TextIndexer (Lucene) index for reading or writing. <br><br> The primary purpose of this method is to open the index identified by the <code>cfgInfo</code> for reading and searching. Index reading and searching operations are used to clean, cull, or optimize an index. Opening an index for writing is performed by the method  {@link XMLTextProcessor#openIdxForWriting() openIdxForWriting()}only when the index is being updated with new document information. <br><br>
 * @param homePath Path from which to resolve relative path names.<br>
 * @param idxInfo  A config structure containing information about the indexto open. <br>
 * @param clean    true to truncate any existing index; false to add to it.<br><br>
 * @param ignoreFileTimes true to ignore file time checks (only appliesduring incremental indexing).
 * @.notes This method will create an index if it doesn't exist, or truncate an index that does exist if the <code>clean</code> flag is set in the <code>cfgInfo</code> structure. <br><br> This method makes a private internal reference {@link XMLTextProcessor#indexInfo indexInfo}to the passed configuration structure for use by other methods in this class. <br><br>
 * @throws IOException  Any I/O exceptions that occurred during the opening,creation, or truncation of the Lucene index. <br><br>
 */
public void open(String homePath,IndexInfo idxInfo,boolean clean,boolean ignoreFileTimes) throws IOException {
  fileQueue=new LinkedList();
  try {
    this.indexInfo=idxInfo;
    this.xtfHomePath=homePath;
    this.ignoreFileTimes=ignoreFileTimes;
    indexPath=getIndexPath();
    if (indexInfo.stopWords != null)     stopSet=BigramStopFilter.makeStopSet(indexInfo.stopWords);
    if (clean) {
      Path.createPath(indexPath);
      createIndex(indexInfo);
    }
 else {
      Path.createPath(indexPath);
      FSDirectory idxDir=NativeFSDirectory.getDirectory(indexPath);
      if (!IndexReader.indexExists(idxDir))       createIndex(indexInfo);
    }
    openIdxForReading();
    Hits match=indexSearcher.search(new TermQuery(new Term("String_Node_Str","String_Node_Str")));
    if (match.length() == 0)     throw new RuntimeException("String_Node_Str");
    Document doc=match.doc(0);
    String indexVersion=doc.get("String_Node_Str");
    if (indexVersion == null)     indexVersion="String_Node_Str";
    if (indexVersion.compareTo(TextIndexer.REQUIRED_VERSION) < 0) {
      throw new RuntimeException("String_Node_Str" + indexVersion + "String_Node_Str"+ TextIndexer.REQUIRED_VERSION+ "String_Node_Str");
    }
    if (Integer.parseInt(doc.get("String_Node_Str")) != indexInfo.getChunkSize()) {
      throw new RuntimeException("String_Node_Str" + doc.get("String_Node_Str") + "String_Node_Str"+ indexInfo.getChunkSize()+ "String_Node_Str");
    }
    if (Integer.parseInt(doc.get("String_Node_Str")) != indexInfo.getChunkOvlp()) {
      throw new RuntimeException("String_Node_Str" + doc.get("String_Node_Str") + "String_Node_Str"+ indexInfo.getChunkOvlp()+ "String_Node_Str");
    }
    String stopWords=indexInfo.stopWords;
    if (stopWords == null)     stopWords="String_Node_Str";
    if (!doc.get("String_Node_Str").equals(stopWords)) {
      throw new RuntimeException("String_Node_Str" + doc.get("String_Node_Str") + "String_Node_Str"+ indexInfo.stopWords+ "String_Node_Str");
    }
    String accentMapName=doc.get("String_Node_Str");
    if (accentMapName != null && accentMapName.length() > 0) {
      File accentMapFile=new File(Path.normalizePath(indexPath + accentMapName));
      InputStream stream=new FileInputStream(accentMapFile);
      if (accentMapName.endsWith("String_Node_Str"))       stream=new GZIPInputStream(stream);
      accentMap=new CharMap(stream);
    }
    String pluralMapName=doc.get("String_Node_Str");
    if (pluralMapName != null && pluralMapName.length() > 0) {
      File pluralMapFile=new File(Path.normalizePath(indexPath + pluralMapName));
      InputStream stream=new FileInputStream(pluralMapFile);
      if (pluralMapName.endsWith("String_Node_Str"))       stream=new GZIPInputStream(stream);
      pluralMap=new WordMap(stream,accentMap);
    }
    tokenizedFields=XtfSearcher.readTokenizedFields(indexPath,indexReader);
  }
 catch (  IOException e) {
    Trace.tab();
    Trace.error("String_Node_Str" + e);
    Trace.untab();
    close();
    throw e;
  }
}