Program: 24725
Project: 24725
Buggy source:
/** 
 * Create a lazy document by loading the original, building the lazy tree, and writing it out.
 * @param lazyFile      Lazy file to create
 * @param sourcePath    Path to the source document
 * @param preFilter     A prefilter stylesheet (or null for no pre-filtering.)
 * @param removeDoctypeDecl true to remove DOCTYPE declarations from theXML document
 * @param stripWhitespace If set, whitespace will be removed between elementsin the lazy file.
 */
private void buildLazyStore(File lazyFile,String sourcePath,Templates preFilter,boolean removeDoctypeDecl,boolean stripWhitespace) throws IOException {
  Path.createPath(lazyFile.getParent());
  Configuration config=new Configuration();
  LazyTreeBuilder lazyBuilder=new LazyTreeBuilder(config);
  StructuredStore lazyStore=StructuredFile.create(lazyFile);
  Receiver lazyReceiver=lazyBuilder.begin(lazyStore);
  try {
    lazyBuilder.setNamePool(NamePool.getDefaultNamePool());
    ReceivingContentHandler lazyHandler=new ReceivingContentHandler();
    lazyHandler.setReceiver(lazyReceiver);
    lazyHandler.setPipelineConfiguration(lazyReceiver.getPipelineConfiguration());
    SAXParser xmlParser=IndexUtil.createSAXParser();
    InputStream inStream=new FileInputStream(sourcePath);
    InputSource inSrc=new InputSource(IndexUtil.filterXMLDocument(inStream,xmlParser,removeDoctypeDecl));
    inSrc.setSystemId(new File(sourcePath).toURL().toString());
    LazyPassthru passthru=new LazyPassthru(lazyHandler,stripWhitespace);
    if (preFilter == null) {
      try {
        xmlParser.parse(inSrc,passthru);
      }
 catch (      Exception e) {
        throw new RuntimeException(e);
      }
    }
 else {
      try {
        Templates[] array=new Templates[1];
        array[0]=preFilter;
        IndexUtil.applyPreFilters(array,xmlParser.getXMLReader(),inSrc,new SAXResult(passthru));
      }
 catch (      Exception e) {
        lazyBuilder.abort(lazyReceiver);
        throw new RuntimeException(e);
      }
    }
    lazyBuilder.finish(lazyReceiver,true);
  }
 catch (  IOException e) {
    lazyBuilder.abort(lazyReceiver);
    throw e;
  }
}

Fixed version (ground truth):
/** 
 * Create a lazy document by loading the original, building the lazy tree, and writing it out.
 * @param lazyFile      Lazy file to create
 * @param sourcePath    Path to the source document
 * @param preFilter     A prefilter stylesheet (or null for no pre-filtering.)
 * @param removeDoctypeDecl true to remove DOCTYPE declarations from theXML document
 * @param stripWhitespace If set, whitespace will be removed between elementsin the lazy file.
 */
private void buildLazyStore(File lazyFile,String sourcePath,Templates preFilter,boolean removeDoctypeDecl,boolean stripWhitespace) throws IOException {
  Path.createPath(lazyFile.getParent());
  File tmpFile=new File(lazyFile.getAbsolutePath() + "String_Node_Str");
  Configuration config=new Configuration();
  LazyTreeBuilder lazyBuilder=new LazyTreeBuilder(config);
  StructuredStore lazyStore=StructuredFile.create(tmpFile);
  SubStoreWriter sub=lazyStore.createSubStore("String_Node_Str");
  sub.writeByte(1);
  sub.close();
  Receiver lazyReceiver=lazyBuilder.begin(lazyStore);
  try {
    ReceivingContentHandler lazyHandler=new ReceivingContentHandler();
    lazyHandler.setReceiver(lazyReceiver);
    lazyHandler.setPipelineConfiguration(lazyReceiver.getPipelineConfiguration());
    SAXParser xmlParser=IndexUtil.createSAXParser();
    InputStream inStream=new FileInputStream(sourcePath);
    InputSource inSrc=new InputSource(IndexUtil.filterXMLDocument(inStream,xmlParser,removeDoctypeDecl));
    inSrc.setSystemId(new File(sourcePath).toURL().toString());
    LazyPassthru passthru=new LazyPassthru(lazyHandler,stripWhitespace);
    if (preFilter == null) {
      try {
        xmlParser.parse(inSrc,passthru);
      }
 catch (      Exception e) {
        throw new RuntimeException(e);
      }
    }
 else {
      try {
        Templates[] array=new Templates[1];
        array[0]=preFilter;
        IndexUtil.applyPreFilters(array,xmlParser.getXMLReader(),inSrc,new SAXResult(passthru));
      }
 catch (      Exception e) {
        lazyBuilder.abort(lazyReceiver);
        throw new RuntimeException(e);
      }
    }
    lazyBuilder.finish(lazyReceiver,true);
    tmpFile.renameTo(lazyFile);
  }
 catch (  IOException e) {
    lazyBuilder.abort(lazyReceiver);
    throw e;
  }
}