Program: 101254
Project: 101254
Buggy source:
@Override public String preProcess(final HtmlPage htmlPage,final String sourceCode,final String sourceName,final int lineNumber,final HtmlElement htmlElement){
  try {
    final String normalizedSourceName=handleEvals(handleInlineScripts(sourceName));
    if (shouldIgnore(normalizedSourceName)) {
      return sourceCode;
    }
    final boolean separateFile=isSeparateFile(sourceName,normalizedSourceName);
    final String fullSourcePath;
    if (separateFile) {
      if (htmlPage != null) {
        fullSourcePath=getFullSourcePath(htmlPage,sourceName);
      }
 else {
        fullSourcePath=new File(normalizedSourceName).getAbsolutePath();
      }
    }
 else {
      fullSourcePath=normalizedSourceName;
    }
    if (cacheInstrumentedCode && instrumentedScriptCache.containsKey(fullSourcePath)) {
      final ScriptData data=instrumentedScriptCache.get(fullSourcePath);
      scriptDataList.add(data);
      return data.getInstrumentedSourceCode();
    }
    final ScriptData data=new ScriptData(fullSourcePath,sourceCode,separateFile);
    scriptDataList.add(data);
    final CompilerEnvirons environs=new CompilerEnvirons();
    environs.initFromContext(contextFactory.enterContext());
    final AstRoot root=new Parser(environs).parse(sourceCode,fullSourcePath,lineNumber);
    root.visit(new InstrumentingVisitor(data,lineNumber - 1));
    final String treeSource=root.toSource();
    final StringBuilder buf=new StringBuilder(initializingCode.length() + data.getNumberOfStatements() * arrayInitializer.length() + treeSource.length());
    buf.append(initializingCode);
    buf.append(String.format("String_Node_Str",coverageVariableName,fullSourcePath));
    for (    final Integer i : data.getLineNumbersOfAllStatements()) {
      buf.append(String.format(arrayInitializer,data.getSourceName(),i));
    }
    buf.append(treeSource);
    final String instrumentedCode=buf.toString();
    data.setInstrumentedSourceCode(instrumentedCode);
    if (cacheInstrumentedCode) {
      instrumentedScriptCache.putIfAbsent(fullSourcePath,data);
    }
    if (outputInstrumentedFiles && separateFile) {
synchronized (writtenToDisk) {
        try {
          if (!writtenToDisk.contains(fullSourcePath)) {
            final File file=new File(fullSourcePath);
            final File fileOutputDir=new File(outputDir,Hashing.md5().hashString(file.getParent()).toString());
            FileUtils.mkdir(fileOutputDir.getAbsolutePath());
            final File outputFile=new File(fileOutputDir,file.getName());
            logger.info("String_Node_Str",outputFile.getAbsolutePath());
            ByteStreams.write(instrumentedCode.getBytes("String_Node_Str"),Files.newOutputStreamSupplier(outputFile));
            writtenToDisk.add(fullSourcePath);
          }
        }
 catch (        final IOException e) {
          throw new RuntimeException(e);
        }
      }
    }
    return instrumentedCode;
  }
 catch (  final RuntimeException e) {
    logger.error("String_Node_Str",e);
    return sourceCode;
  }
}

Fixed version (ground truth):
@Override public String preProcess(final HtmlPage htmlPage,final String sourceCode,final String sourceName,final int lineNumber,final HtmlElement htmlElement){
  try {
    final String normalizedSourceName=handleEvals(handleInlineScripts(sourceName));
    if (shouldIgnore(normalizedSourceName)) {
      return sourceCode;
    }
    final boolean separateFile=isSeparateFile(sourceName,normalizedSourceName);
    final String fullSourcePath;
    if (separateFile) {
      if (htmlPage != null) {
        fullSourcePath=getFullSourcePath(htmlPage,sourceName);
      }
 else {
        fullSourcePath=new File(normalizedSourceName).getAbsolutePath();
      }
    }
 else {
      fullSourcePath=normalizedSourceName;
    }
    if (cacheInstrumentedCode && instrumentedScriptCache.containsKey(fullSourcePath)) {
      final ScriptData data=instrumentedScriptCache.get(fullSourcePath);
      scriptDataList.add(data);
      return data.getInstrumentedSourceCode();
    }
    final ScriptData data=new ScriptData(fullSourcePath,sourceCode,separateFile);
    scriptDataList.add(data);
    final CompilerEnvirons environs=new CompilerEnvirons();
    environs.initFromContext(contextFactory.enterContext());
    final AstRoot root=new Parser(environs).parse(data.getSourceCode(),data.getSourceName(),lineNumber);
    root.visit(new InstrumentingVisitor(data,lineNumber - 1));
    final String treeSource=root.toSource();
    final StringBuilder buf=new StringBuilder(initializingCode.length() + data.getNumberOfStatements() * arrayInitializer.length() + treeSource.length());
    buf.append(initializingCode);
    buf.append(String.format("String_Node_Str",coverageVariableName,escapePath(data.getSourceName())));
    for (    final Integer i : data.getLineNumbersOfAllStatements()) {
      buf.append(String.format(arrayInitializer,escapePath(data.getSourceName()),i));
    }
    buf.append(treeSource);
    final String instrumentedCode=buf.toString();
    data.setInstrumentedSourceCode(instrumentedCode);
    if (cacheInstrumentedCode) {
      instrumentedScriptCache.putIfAbsent(data.getSourceName(),data);
    }
    if (outputInstrumentedFiles && separateFile) {
synchronized (writtenToDisk) {
        try {
          if (!writtenToDisk.contains(data.getSourceName())) {
            final File file=new File(data.getSourceName());
            final File fileOutputDir=new File(outputDir,Hashing.md5().hashString(file.getParent()).toString());
            FileUtils.mkdir(fileOutputDir.getAbsolutePath());
            final File outputFile=new File(fileOutputDir,file.getName());
            logger.info("String_Node_Str",outputFile.getAbsolutePath());
            ByteStreams.write(instrumentedCode.getBytes("String_Node_Str"),Files.newOutputStreamSupplier(outputFile));
            writtenToDisk.add(data.getSourceName());
          }
        }
 catch (        final IOException e) {
          throw new RuntimeException(e);
        }
      }
    }
    return instrumentedCode;
  }
 catch (  final RuntimeException e) {
    logger.error("String_Node_Str",e);
    return sourceCode;
  }
}