nus-yam/ex-repair huggingface dataset:
Program: 101241
Project: 101241
Buggy source:
@Override public void preloadSources(final Config config,final ScriptInstrumenter instrumenter,final RunStats totalStats) throws IOException {
  final String sourcesToPreload=config.getSourcesToPreload();
  final URI baseUri=config.getBaseUri();
  if (sourcesToPreload == null || !config.getOutputStrategy().contains(OutputStrategy.TOTAL) || !UriUtil.isFileUri(baseUri)) {
    return;
  }
  final String sourcesToPreloadEncoding=config.getSourcesToPreloadEncoding();
  logger.info("String_Node_Str",sourcesToPreloadEncoding);
  final List<File> filesToPreload=FileUtils.getFiles(new File(baseUri),sourcesToPreload,null);
  logger.info("String_Node_Str",filesToPreload.size());
  for (  final File file : filesToPreload) {
    logger.debug("String_Node_Str",file);
    final String source=CharStreams.toString(Files.newReaderSupplier(file,Charset.forName(sourcesToPreloadEncoding)));
    instrumenter.preProcess(null,source,file.getAbsolutePath(),0,null);
  }
  for (  final ScriptData data : instrumenter.getScriptDataList()) {
    final Map<Integer,Double> coverageData=Maps.newHashMap();
    for (    final Integer lineNumber : data.getLineNumbersOfAllStatements()) {
      coverageData.put(lineNumber,0.0);
    }
    totalStats.add(data.generateFileStats(baseUri,coverageData));
  }
}

Fixed version (ground truth):
@Override public void preloadSources(final Config config,final ScriptInstrumenter instrumenter,final RunStats totalStats) throws IOException {
  final String sourcesToPreload=config.getSourcesToPreload();
  final URI baseUri=config.getBaseUri();
  if (sourcesToPreload == null || !config.getOutputStrategy().contains(OutputStrategy.TOTAL) || !UriUtil.isFileUri(baseUri)) {
    return;
  }
  final String sourcesToPreloadEncoding=config.getSourcesToPreloadEncoding();
  logger.info("String_Node_Str",sourcesToPreloadEncoding);
  final List<File> filesToPreload=FileUtils.getFiles(new File(baseUri),sourcesToPreload,null);
  logger.info("String_Node_Str",filesToPreload.size());
  for (  final File file : filesToPreload) {
    logger.debug("String_Node_Str",file);
    final String source=CharStreams.toString(Files.newReaderSupplier(file,Charset.forName(sourcesToPreloadEncoding)));
    instrumenter.preProcess(null,source,file.toURI().toString(),0,null);
  }
  for (  final ScriptData data : instrumenter.getScriptDataList()) {
    final Map<Integer,Double> coverageData=Maps.newHashMap();
    for (    final Integer lineNumber : data.getLineNumbersOfAllStatements()) {
      coverageData.put(lineNumber,0.0);
    }
    totalStats.add(data.generateFileStats(baseUri,coverageData));
  }
}
Program: 101242
Project: 101242
Buggy source:
void add(final FileStats newStats){
  final String key=newStats.getFullName();
  final FileStats oldStats=fileStatsMap.get(key);
  if (oldStats != null) {
    fileStatsMap.put(key,FileStats.merge(newStats,oldStats));
  }
 else {
    fileStatsMap.put(key,newStats);
  }
}

Fixed version (ground truth):
void add(final FileStats newStats){
  final URI key=newStats.getFileUri();
  final FileStats oldStats=fileStatsMap.get(key);
  if (oldStats != null) {
    fileStatsMap.put(key,FileStats.merge(newStats,oldStats));
  }
 else {
    fileStatsMap.put(key,newStats);
  }
}
Program: 101243
Project: 101243
Buggy source:
public String getTestName(){
  final Optional<String> lastSegment=UriUtil.getLastSegment(test);
  if (lastSegment.isPresent()) {
    return lastSegment.get();
  }
  return test.getHost();
}

Fixed version (ground truth):
public String getTestName(){
  return UriUtil.getLastSegmentOrHost(test);
}
Program: 101244
Project: 101244
Buggy source:
ScriptData(final String sourceName,final String sourceCode,final boolean separateFile){
  this.sourceName=sourceName;
  this.sourceCode=sourceCode;
  this.separateFile=separateFile;
}

Fixed version (ground truth):
ScriptData(final URI sourceUri,final String sourceCode,final boolean separateFile){
  this.sourceUri=sourceUri;
  this.sourceCode=sourceCode;
  this.separateFile=separateFile;
}
Program: 101245
Project: 101245
Buggy source:
public FileStats generateFileStats(final URI baseUri,final Map<Integer,Double> coverageData){
  final Scanner in=new Scanner(getSourceCode());
  final List<LineCoverageRecord> lineCoverageRecords=Lists.newArrayList();
  if (!getLineNumbersOfAllStatements().isEmpty()) {
    for (int lineNr=1; lineNr < getLineNumberOfFirstStatement() && in.hasNext(); lineNr++) {
      lineCoverageRecords.add(new LineCoverageRecord(lineNr,-1,in.nextLine()));
    }
    for (int lineNr=getLineNumberOfFirstStatement(), lengthCountdown=0; in.hasNext(); lineNr++) {
      final String line=in.nextLine();
      final Double coverageEntry=coverageData.get(lineNr);
      final int timesLineExecuted;
      if (coverageEntry == null) {
        final int lineLength=line.trim().length();
        if (lengthCountdown > 0 && lineLength > 0) {
          lengthCountdown-=lineLength;
          timesLineExecuted=-1;
        }
 else {
          timesLineExecuted=hasStatement(lineNr) ? 0 : -1;
        }
      }
 else {
        timesLineExecuted=coverageEntry.intValue();
        if (getStatementLength(lineNr) != null) {
          lengthCountdown=getStatementLength(lineNr);
        }
      }
      lineCoverageRecords.add(new LineCoverageRecord(lineNr,timesLineExecuted,line));
    }
  }
 else {
    for (int lineNr=1; in.hasNext(); lineNr++) {
      lineCoverageRecords.add(new LineCoverageRecord(lineNr,-1,in.nextLine()));
    }
  }
  return new FileStats(baseUri,getSourceName(),lineCoverageRecords,isSeparateFile());
}

Fixed version (ground truth):
public FileStats generateFileStats(final URI baseUri,final Map<Integer,Double> coverageData){
  final Scanner in=new Scanner(getSourceCode());
  final List<LineCoverageRecord> lineCoverageRecords=Lists.newArrayList();
  if (!getLineNumbersOfAllStatements().isEmpty()) {
    for (int lineNr=1; lineNr < getLineNumberOfFirstStatement() && in.hasNext(); lineNr++) {
      lineCoverageRecords.add(new LineCoverageRecord(lineNr,-1,in.nextLine()));
    }
    for (int lineNr=getLineNumberOfFirstStatement(), lengthCountdown=0; in.hasNext(); lineNr++) {
      final String line=in.nextLine();
      final Double coverageEntry=coverageData.get(lineNr);
      final int timesLineExecuted;
      if (coverageEntry == null) {
        final int lineLength=line.trim().length();
        if (lengthCountdown > 0 && lineLength > 0) {
          lengthCountdown-=lineLength;
          timesLineExecuted=-1;
        }
 else {
          timesLineExecuted=hasStatement(lineNr) ? 0 : -1;
        }
      }
 else {
        timesLineExecuted=coverageEntry.intValue();
        if (getStatementLength(lineNr) != null) {
          lengthCountdown=getStatementLength(lineNr);
        }
      }
      lineCoverageRecords.add(new LineCoverageRecord(lineNr,timesLineExecuted,line));
    }
  }
 else {
    for (int lineNr=1; in.hasNext(); lineNr++) {
      lineCoverageRecords.add(new LineCoverageRecord(lineNr,-1,in.nextLine()));
    }
  }
  return new FileStats(baseUri,getSourceUri(),lineCoverageRecords,isSeparateFile());
}
Program: 101246
Project: 101246
Buggy source:
private AstNode newInstrumentationNode(final int lineNr){
  final ExpressionStatement instrumentationNode=new ExpressionStatement();
  final UnaryExpression inc=new UnaryExpression();
  inc.setIsPostfix(true);
  inc.setOperator(Token.INC);
  final ElementGet outer=new ElementGet();
  final ElementGet inner=new ElementGet();
  outer.setTarget(inner);
  final Name covDataVar=new Name();
  covDataVar.setIdentifier(coverageVariableName);
  inner.setTarget(covDataVar);
  final StringLiteral fileName=new StringLiteral();
  fileName.setValue(data.getSourceName());
  fileName.setQuoteCharacter('\'');
  inner.setElement(fileName);
  final NumberLiteral index=new NumberLiteral();
  index.setNumber(lineNr);
  index.setValue(Integer.toString(lineNr));
  outer.setElement(index);
  inc.setOperand(outer);
  instrumentationNode.setExpression(inc);
  instrumentationNode.setHasResult();
  return instrumentationNode;
}

Fixed version (ground truth):
private AstNode newInstrumentationNode(final int lineNr){
  final ExpressionStatement instrumentationNode=new ExpressionStatement();
  final UnaryExpression inc=new UnaryExpression();
  inc.setIsPostfix(true);
  inc.setOperator(Token.INC);
  final ElementGet outer=new ElementGet();
  final ElementGet inner=new ElementGet();
  outer.setTarget(inner);
  final Name covDataVar=new Name();
  covDataVar.setIdentifier(coverageVariableName);
  inner.setTarget(covDataVar);
  final StringLiteral fileName=new StringLiteral();
  fileName.setValue(data.getSourceUriAsString());
  fileName.setQuoteCharacter('\'');
  inner.setElement(fileName);
  final NumberLiteral index=new NumberLiteral();
  index.setNumber(lineNr);
  index.setValue(Integer.toString(lineNr));
  outer.setElement(index);
  inc.setOperand(outer);
  instrumentationNode.setExpression(inc);
  instrumentationNode.setHasResult();
  return instrumentationNode;
}
Program: 101248
Project: 101248
Buggy source:
@Override public List<URI> fetch(final URI baseUri,final String includes,final String excludes){
  return ImmutableList.of(baseUri);
}

Fixed version (ground truth):
@Override public List<URI> fetch(final URI baseUri,final String includes,final String excludes){
  if (StringUtils.isNotBlank(includes) || StringUtils.isNotBlank(excludes)) {
    logger.warn("String_Node_Str");
  }
  return ImmutableList.of(baseUri);
}
Program: 101249
Project: 101249
Buggy source:
/** 
 * fix the fact that NumberLiteral outputs hexadecimal numbers without the '0x' part (e.g. 0xFF becomes FF when toSource() is called), which results in invalid JS syntax. Using the actual number value instead to fix this (shouldn't break anything)
 */
private void handleNumberLiteralBug(final AstNode node){
  if (node.getType() == Token.NUMBER) {
    final NumberLiteral numberLiteral=(NumberLiteral)node;
    numberLiteral.setValue(getValue(numberLiteral));
    handleVoidBug(node.getParent());
  }
}

Fixed version (ground truth):
/** 
 * fix the fact that NumberLiteral outputs hexadecimal numbers without the '0x' part (e.g. 0xFF becomes FF when toSource() is called), which results in invalid JS syntax. Using the actual number value instead to fix this (shouldn't break anything)
 */
private void handleNumberLiteralBug(final AstNode node){
  if (node.getType() == Token.NUMBER) {
    final NumberLiteral numberLiteral=(NumberLiteral)node;
    numberLiteral.setValue(getValue(numberLiteral));
  }
}
Program: 101250
Project: 101250
Buggy source:
@Override public boolean visit(final AstNode node){
  handleVoidBug(node);
  handleNumberLiteralBug(node);
  if (isExecutableBlock(node)) {
    addInstrumentationSnippetFor(node);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean visit(final AstNode node){
  handleNumberLiteralBug(node);
  if (isExecutableBlock(node)) {
    addInstrumentationSnippetFor(node);
  }
  return true;
}
Program: 101253
Project: 101253
Buggy source:
@SuppressWarnings("String_Node_Str") private RunStats collectAndWriteRunStats(final File test,final ScriptInstrumenter instrumenter,final NativeObject allCoverageData) throws IOException {
  final RunStats runStats=new RunStats(test);
  for (  final ScriptData data : instrumenter.getScriptDataList()) {
    final FileStats fileStats=getFileStatsFromScriptData(allCoverageData,data);
    runStats.add(fileStats);
  }
  return runStats;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private RunStats collectAndWriteRunStats(final File test,final ScriptInstrumenter instrumenter,final NativeObject allCoverageData) throws IOException {
  final RunStats runStats=new RunStats(test);
  for (  final ScriptData data : instrumenter.getScriptDataList()) {
    final Map<Integer,Double> coverageData=(Map)allCoverageData.get(data.getSourceName());
    final FileStats fileStats=getFileStatsFromScriptData(coverageData,data);
    runStats.add(fileStats);
  }
  return runStats;
}
Program: 101256
Project: 101256
Buggy source:
void add(final FileStats newStats){
  String key;
  try {
    key=newStats.getFilePath();
  }
 catch (  final IllegalArgumentException e) {
    logger.debug("String_Node_Str",e);
    key=newStats.getFullName();
  }
  final FileStats oldStats=fileStatsMap.get(key);
  if (oldStats != null) {
    fileStatsMap.put(key,FileStats.merge(newStats,oldStats));
  }
 else {
    fileStatsMap.put(key,newStats);
  }
}

Fixed version (ground truth):
void add(final FileStats newStats){
  final String key=newStats.getFullName();
  final FileStats oldStats=fileStatsMap.get(key);
  if (oldStats != null) {
    fileStatsMap.put(key,FileStats.merge(newStats,oldStats));
  }
 else {
    fileStatsMap.put(key,newStats);
  }
}
Program: 101258
Project: 101258
Buggy source:
private void addInstrumentationSnippetFor(final AstNode node){
  final AstNode parent=node.getParent();
  final int type=node.getType();
  final int parentType=parent.getType();
  if (type == WHILE || type == FOR || type == DO) {
    fixLoops((Loop)node);
  }
  if (type == CASE) {
    handleSwitchCase((SwitchCase)node);
  }
 else   if (type == IF && parentType == IF) {
    final IfStatement elseIfStatement=(IfStatement)node;
    final IfStatement ifStatement=(IfStatement)parent;
    if (ifStatement.getElsePart() == elseIfStatement) {
      flattenElseIf(elseIfStatement,ifStatement);
      data.addExecutableLine(getActualLineNumber(node),node.getLength());
    }
  }
 else   if (parentType != CASE) {
    if (parent.hasChildren()) {
      parent.addChildBefore(newInstrumentationNode(getActualLineNumber(node)),node);
    }
 else {
      final Block block=newInstrumentedBlock(node);
      if (parentType == IF) {
        final IfStatement ifStatement=(IfStatement)parent;
        if (ifStatement.getThenPart() == node) {
          ifStatement.setThenPart(block);
        }
 else         if (ifStatement.getElsePart() == node) {
          ifStatement.setElsePart(block);
        }
      }
 else       if (parentType == WHILE || parentType == FOR || parentType == DO) {
        ((Loop)parent).setBody(block);
      }
 else {
        logger.warn("String_Node_Str",parent.toSource());
      }
    }
    data.addExecutableLine(getActualLineNumber(node),node.getLength());
  }
}

Fixed version (ground truth):
private void addInstrumentationSnippetFor(final AstNode node){
  final AstNode parent=node.getParent();
  final int type=node.getType();
  final int parentType=parent.getType();
  if (type == WHILE || type == FOR || type == DO) {
    fixLoops((Loop)node);
  }
  if (type == IF) {
    fixIf((IfStatement)node);
  }
  if (type == CASE) {
    handleSwitchCase((SwitchCase)node);
  }
 else   if (type == IF && parentType == IF) {
    final IfStatement elseIfStatement=(IfStatement)node;
    final IfStatement ifStatement=(IfStatement)parent;
    if (ifStatement.getElsePart() == elseIfStatement) {
      flattenElseIf(elseIfStatement,ifStatement);
      data.addExecutableLine(getActualLineNumber(node),node.getLength());
    }
  }
 else   if (parentType != CASE) {
    if (parent.hasChildren()) {
      parent.addChildBefore(newInstrumentationNode(getActualLineNumber(node)),node);
    }
 else {
      final Block block=newInstrumentedBlock(node);
      if (parentType == IF) {
        final IfStatement ifStatement=(IfStatement)parent;
        if (ifStatement.getThenPart() == node) {
          ifStatement.setThenPart(block);
        }
 else         if (ifStatement.getElsePart() == node) {
          ifStatement.setElsePart(block);
        }
      }
 else       if (parentType == WHILE || parentType == FOR || parentType == DO) {
        ((Loop)parent).setBody(block);
      }
 else {
        logger.warn("String_Node_Str",parent.toSource());
      }
    }
    data.addExecutableLine(getActualLineNumber(node),node.getLength());
  }
}
Program: 101259
Project: 101259
Buggy source:
@Test public void preProcess(){
  final String sourceName="String_Node_Str";
  final ScriptInstrumenter instrumenter=new ScriptInstrumenter(factory,COVERAGE_VARIABLE_NAME);
  instrumenter.preProcess(htmlPage,Data.getClassJsSourceCode(),sourceName,1,htmlElement);
  assertEquals(1,instrumenter.getScriptDataList().size());
  final ScriptData classJsData=instrumenter.getScriptDataList().get(0);
  assertEquals("String_Node_Str",classJsData.getSourceName());
  assertEquals(5,classJsData.getLineNumberOfFirstStatement());
  assertEquals(106,classJsData.getNumberOfStatements());
  assertEquals(Data.getClassJsInstrumented(),classJsData.getInstrumentedSourceCode());
}

Fixed version (ground truth):
@Test public void preProcess(){
  final String sourceName="String_Node_Str";
  final ScriptInstrumenter instrumenter=new ScriptInstrumenter(factory,COVERAGE_VARIABLE_NAME);
  instrumenter.preProcess(htmlPage,Data.getClassJsSourceCode(),sourceName,1,htmlElement);
  assertEquals(1,instrumenter.getScriptDataList().size());
  final ScriptData classJsData=instrumenter.getScriptDataList().get(0);
  assertEquals("String_Node_Str",classJsData.getSourceName());
  assertEquals(5,classJsData.getLineNumberOfFirstStatement());
  assertEquals(110,classJsData.getNumberOfStatements());
  assertEquals(Data.getClassJsInstrumented(),classJsData.getInstrumentedSourceCode());
}
Program: 101260
Project: 101260
Buggy source:
private String getRelativeName(String fullName){
  String relativeName;
  try {
    relativeName=ResourceUtils.getRelativePath(fullName,new File(System.getProperty("String_Node_Str")).toURI().toString(),File.separator);
  }
 catch (  final Exception e) {
    logger.debug(e.getMessage(),e);
    relativeName=fullName;
  }
  return relativeName;
}

Fixed version (ground truth):
public String getRelativeName(){
  return normalizeFileSeparators(relativeName);
}
Program: 101261
Project: 101261
Buggy source:
void add(final FileStats newStats){
  final String key=newStats.fullName;
  final FileStats oldStats=fileStatsMap.get(key);
  if (oldStats != null) {
    fileStatsMap.put(key,FileStats.merge(newStats,oldStats));
  }
 else {
    fileStatsMap.put(key,newStats);
  }
}

Fixed version (ground truth):
void add(final FileStats newStats){
  final String key=newStats.getFullName();
  final FileStats oldStats=fileStatsMap.get(key);
  if (oldStats != null) {
    fileStatsMap.put(key,FileStats.merge(newStats,oldStats));
  }
 else {
    fileStatsMap.put(key,newStats);
  }
}
Program: 101263
Project: 101263
Buggy source:
public CoverageGenerator(final File baseDir,final String includes,final String excludes,final File outputDir){
  Validate.isTrue(baseDir.exists(),"String_Node_Str");
  this.baseDir=baseDir;
  this.includes=includes;
  this.excludes=excludes;
  this.outputDir=outputDir;
  stringTemplateGroup=new STGroupDir("String_Node_Str",'$','$');
}

Fixed version (ground truth):
public CoverageGenerator(final File baseDir,final String includes,final String excludes,final File outputDir){
  Validate.isTrue(baseDir.exists(),"String_Node_Str");
  this.baseDir=baseDir;
  this.includes=includes;
  this.excludes=excludes;
  this.outputDir=outputDir;
  stringTemplateGroup=new STGroupDir("String_Node_Str",'$','$');
  LogFactory.getFactory().setAttribute("String_Node_Str","String_Node_Str");
  java.util.logging.Logger.getLogger("String_Node_Str").setLevel(Level.OFF);
  java.util.logging.Logger.getLogger("String_Node_Str").setLevel(Level.OFF);
}
Program: 101265
Project: 101265
Buggy source:
@Override public RunStats call(){
  logger.info("String_Node_Str",test.getAbsoluteFile().toURI().normalize().getPath());
  try {
    final RunStats runStats=runTest(test);
    if (outputStrategy.contains(OutputStrategy.PER_TEST)) {
      writeRunStats(runStats);
    }
    return runStats;
  }
 catch (  final IOException e) {
    logger.error(e.getMessage(),e);
    return null;
  }
}

Fixed version (ground truth):
@Override public RunStats call(){
  logger.info("String_Node_Str",test.getAbsoluteFile().toURI().normalize().getPath());
  try {
    final RunStats runStats=runTest(test);
    if (outputStrategy.contains(OutputStrategy.PER_TEST)) {
      writeRunStats(runStats);
    }
    return runStats;
  }
 catch (  final IOException e) {
    return RunStats.EMPTY;
  }
}
Program: 101266
Project: 101266
Buggy source:
private RunStats runTest(final File test) throws IOException {
  final WebClient client=localClient.get();
  final File instrumentedFileDirectory=new File(outputDir,instrumentedFileDirectoryName);
  final ScriptInstrumenter instrumenter=new ScriptInstrumenter(client.getJavaScriptEngine().getContextFactory(),coverageVariableName);
  instrumenter.setIgnorePatterns(noInstrumentPatterns);
  if (outputInstrumentedFiles) {
    FileUtils.mkdir(instrumentedFileDirectory.getAbsolutePath());
    instrumenter.setOutputDir(instrumentedFileDirectory);
    instrumenter.setOutputInstrumentedFiles(outputInstrumentedFiles);
  }
  instrumenter.setCacheInstrumentedCode(cacheInstrumentedCode);
  client.setScriptPreProcessor(instrumenter);
  final Page page=client.getPage(test.toURI().toURL());
  if (page instanceof HtmlPage) {
    final HtmlPage htmlPage=(HtmlPage)page;
    client.waitForBackgroundJavaScript(30000);
    client.setScriptPreProcessor(null);
    final NativeObject coverageData=(NativeObject)htmlPage.executeJavaScript(coverageVariableName).getJavaScriptResult();
    return collectAndWriteRunStats(test,instrumenter,coverageData);
  }
  return null;
}

Fixed version (ground truth):
private RunStats runTest(final File test) throws IOException {
  final WebClient client=localClient.get();
  final File instrumentedFileDirectory=new File(outputDir,instrumentedFileDirectoryName);
  final ScriptInstrumenter instrumenter=new ScriptInstrumenter(client.getJavaScriptEngine().getContextFactory(),coverageVariableName);
  instrumenter.setIgnorePatterns(noInstrumentPatterns);
  if (outputInstrumentedFiles) {
    FileUtils.mkdir(instrumentedFileDirectory.getAbsolutePath());
    instrumenter.setOutputDir(instrumentedFileDirectory);
    instrumenter.setOutputInstrumentedFiles(outputInstrumentedFiles);
  }
  instrumenter.setCacheInstrumentedCode(cacheInstrumentedCode);
  client.setScriptPreProcessor(instrumenter);
  final Page page=client.getPage(test.toURI().toURL());
  if (page instanceof HtmlPage) {
    final HtmlPage htmlPage=(HtmlPage)page;
    client.waitForBackgroundJavaScript(30000);
    client.setScriptPreProcessor(null);
    final Object javaScriptResult=htmlPage.executeJavaScript("String_Node_Str" + coverageVariableName).getJavaScriptResult();
    if (!(javaScriptResult instanceof Undefined)) {
      return collectAndWriteRunStats(test,instrumenter,(NativeObject)javaScriptResult);
    }
  }
  return RunStats.EMPTY;
}
Program: 101267
Project: 101267
Buggy source:
@Override public void loadScriptError(final HtmlPage htmlPage,final URL scriptUrl,final Exception e){
  logger.error("String_Node_Str",new Object[]{htmlPage.getUrl(),scriptUrl,e.getMessage()});
  logger.debug(e.getMessage(),e);
}

Fixed version (ground truth):
@Override public void loadScriptError(final HtmlPage htmlPage,final URL scriptUrl,final Exception e){
  logger.warn("String_Node_Str",new Object[]{htmlPage.getUrl(),scriptUrl,e.getMessage()});
  logger.debug(e.getMessage(),e);
}
Program: 101268
Project: 101268
Buggy source:
@Override protected WebClient initialValue(){
  final WebClient client=new WebClient(BrowserVersion.FIREFOX_3_6);
  client.setIncorrectnessListener(quietIncorrectnessListener);
  client.setJavaScriptErrorListener(loggingJsErrorListener);
  client.setHTMLParserListener(quietHtmlParserListener);
  client.setCssErrorHandler(quietCssErrorHandler);
  client.setJavaScriptEnabled(true);
  client.setAjaxController(new NicelyResynchronizingAjaxController());
  client.setThrowExceptionOnScriptError(false);
  client.setThrowExceptionOnFailingStatusCode(false);
  client.setPrintContentOnFailingStatusCode(false);
  return client;
}

Fixed version (ground truth):
@Override protected WebClient initialValue(){
  final WebClient client=new WebClient(BrowserVersion.FIREFOX_3_6){
    @Override public WebResponse loadWebResponse(    final WebRequest webRequest) throws IOException {
      return new WebResponseProxy(super.loadWebResponse(webRequest));
    }
  }
;
  client.setIncorrectnessListener(quietIncorrectnessListener);
  client.setJavaScriptErrorListener(loggingJsErrorListener);
  client.setHTMLParserListener(quietHtmlParserListener);
  client.setCssErrorHandler(quietCssErrorHandler);
  client.setJavaScriptEnabled(true);
  client.setAjaxController(new NicelyResynchronizingAjaxController());
  client.setThrowExceptionOnScriptError(false);
  client.setThrowExceptionOnFailingStatusCode(false);
  client.setPrintContentOnFailingStatusCode(false);
  client.setWebConnection(new HttpWebConnection(client){
    @Override protected WebResponse newWebResponseInstance(    final WebResponseData responseData,    final long loadTime,    final WebRequest request){
      return new WebResponseProxy(super.newWebResponseInstance(responseData,loadTime,request));
    }
  }
);
  return client;
}
Program: 101270
Project: 101270
Buggy source:
@Override public RunStats call(){
  logger.info("String_Node_Str",test.getAbsoluteFile().toURI().normalize().getPath());
  try {
    final RunStats runStats=runTest(test);
    if (outputStrategy.contains(OutputStrategy.PER_TEST)) {
      writeRunStats(runStats);
    }
    return runStats;
  }
 catch (  final IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Override public RunStats call(){
  logger.info("String_Node_Str",test.getAbsoluteFile().toURI().normalize().getPath());
  try {
    final RunStats runStats=runTest(test);
    if (outputStrategy.contains(OutputStrategy.PER_TEST)) {
      writeRunStats(runStats);
    }
    return runStats;
  }
 catch (  final IOException e) {
    logger.error(e.getMessage(),e);
    return null;
  }
}
Program: 101271
Project: 101271
Buggy source:
private void writeRunStats(final RunStats stats) throws IOException {
  final URI relativeTestUri=baseDir.toURI().relativize(stats.test.toURI());
  final File fileOutputDir=new File(new File(outputDir.toURI().resolve(relativeTestUri)).getParent());
  FileUtils.mkdir(fileOutputDir.getAbsolutePath());
  final File outputFile=new File(fileOutputDir,stats.getReportName());
  logger.info("String_Node_Str",outputFile.getAbsoluteFile());
synchronized (stringTemplateGroup) {
    stringTemplateGroup.getInstanceOf("String_Node_Str").add("String_Node_Str",stats).add("String_Node_Str",config.getString("String_Node_Str")).add("String_Node_Str",config.getString("String_Node_Str")).add("String_Node_Str",config.getString("String_Node_Str")).write(outputFile,new ErrorLogger());
  }
}

Fixed version (ground truth):
private void writeRunStats(final RunStats stats) throws IOException {
  final URI relativeTestUri=baseDir.toURI().relativize(stats.test.toURI());
  final File fileOutputDir=new File(new File(outputDir.toURI().resolve(relativeTestUri)).getParent());
  FileUtils.mkdir(fileOutputDir.getAbsolutePath());
  final File outputFile=new File(fileOutputDir,stats.getReportName());
  logger.info("String_Node_Str",outputFile.getAbsoluteFile());
synchronized (stringTemplateGroup) {
    stringTemplateGroup.getInstanceOf("String_Node_Str").add("String_Node_Str",stats).add("String_Node_Str",config.getString("String_Node_Str")).add("String_Node_Str",config.getString("String_Node_Str")).add("String_Node_Str",config.getString("String_Node_Str")).write(outputFile,new LoggingStringTemplateErrorListener());
  }
}
Program: 101274
Project: 101274
Buggy source:
private void addInstrumentationSnippetFor(final AstNode node){
  final AstNode parent=node.getParent();
  final int type=node.getType();
  final int parentType=parent.getType();
  if (type == CASE) {
    handleSwitchCase((SwitchCase)node);
  }
 else   if (type == IF && parentType == IF) {
    flattenElseIf((IfStatement)node,(IfStatement)parent);
    data.addExecutableLine(getActualLineNumber(node),node.getLength());
  }
 else   if (parentType != CASE) {
    if (parent.hasChildren()) {
      parent.addChildBefore(newInstrumentationNode(getActualLineNumber(node)),node);
    }
 else {
      final Block block=newInstrumentedBlock(node);
      if (parentType == IF) {
        final IfStatement ifStatement=(IfStatement)parent;
        if (ifStatement.getThenPart() == node) {
          ifStatement.setThenPart(block);
        }
 else         if (ifStatement.getElsePart() == node) {
          ifStatement.setElsePart(block);
        }
      }
 else       if (parentType == WHILE || parentType == FOR || parentType == DO) {
        ((Loop)parent).setBody(block);
      }
 else {
        logger.warn("String_Node_Str",parent.toSource());
      }
    }
    data.addExecutableLine(getActualLineNumber(node),node.getLength());
  }
}

Fixed version (ground truth):
private void addInstrumentationSnippetFor(final AstNode node){
  final AstNode parent=node.getParent();
  final int type=node.getType();
  final int parentType=parent.getType();
  if (type == WHILE || type == FOR || type == DO) {
    fixLoops((Loop)node);
  }
  if (type == CASE) {
    handleSwitchCase((SwitchCase)node);
  }
 else   if (type == IF && parentType == IF) {
    final IfStatement elseIfStatement=(IfStatement)node;
    final IfStatement ifStatement=(IfStatement)parent;
    if (ifStatement.getElsePart() == elseIfStatement) {
      flattenElseIf(elseIfStatement,ifStatement);
      data.addExecutableLine(getActualLineNumber(node),node.getLength());
    }
  }
 else   if (parentType != CASE) {
    if (parent.hasChildren()) {
      parent.addChildBefore(newInstrumentationNode(getActualLineNumber(node)),node);
    }
 else {
      final Block block=newInstrumentedBlock(node);
      if (parentType == IF) {
        final IfStatement ifStatement=(IfStatement)parent;
        if (ifStatement.getThenPart() == node) {
          ifStatement.setThenPart(block);
        }
 else         if (ifStatement.getElsePart() == node) {
          ifStatement.setElsePart(block);
        }
      }
 else       if (parentType == WHILE || parentType == FOR || parentType == DO) {
        ((Loop)parent).setBody(block);
      }
 else {
        logger.warn("String_Node_Str",parent.toSource());
      }
    }
    data.addExecutableLine(getActualLineNumber(node),node.getLength());
  }
}
Program: 101275
Project: 101275
Buggy source:
@Test public void preProcess(){
  final String sourceName="String_Node_Str";
  final ScriptInstrumenter instrumenter=new ScriptInstrumenter(factory,COVERAGE_VARIABLE_NAME);
  instrumenter.preProcess(htmlPage,Data.getClassJsSourceCode(),sourceName,1,htmlElement);
  assertEquals(1,instrumenter.getScriptDataList().size());
  final ScriptData classJsData=instrumenter.getScriptDataList().get(0);
  assertEquals("String_Node_Str",classJsData.getSourceName());
  assertEquals(5,classJsData.getLineNumberOfFirstStatement());
  assertEquals(96,classJsData.getNumberOfStatements());
  assertEquals(Data.getClassJsInstrumented(),classJsData.getInstrumentedSourceCode());
}

Fixed version (ground truth):
@Test public void preProcess(){
  final String sourceName="String_Node_Str";
  final ScriptInstrumenter instrumenter=new ScriptInstrumenter(factory,COVERAGE_VARIABLE_NAME);
  instrumenter.preProcess(htmlPage,Data.getClassJsSourceCode(),sourceName,1,htmlElement);
  assertEquals(1,instrumenter.getScriptDataList().size());
  final ScriptData classJsData=instrumenter.getScriptDataList().get(0);
  assertEquals("String_Node_Str",classJsData.getSourceName());
  assertEquals(5,classJsData.getLineNumberOfFirstStatement());
  assertEquals(106,classJsData.getNumberOfStatements());
  assertEquals(Data.getClassJsInstrumented(),classJsData.getInstrumentedSourceCode());
}
Program: 101276
Project: 101276
Buggy source:
private RunStats collectAndWriteRunStats(final File test,final ScriptInstrumenter instrumenter,final NativeObject allCoverageData) throws IOException {
  final RunStats runStats=new RunStats(test);
  for (  final ScriptData data : instrumenter.getScriptDataList()) {
    final Scanner in=new Scanner(data.getSourceCode());
    final NativeObject coverageData=(NativeObject)allCoverageData.get(data.getSourceName());
    final List<LineCoverageRecord> lineCoverageRecords=Lists.newArrayList();
    for (int lineCount=1, lineNr=data.getLineNumberOfFirstStatement(), lengthCountdown=0; in.hasNext(); lineCount++, lineNr++) {
      final String line=in.nextLine();
      final Double coverageEntry=(Double)coverageData.get(lineNr);
      final int timesLineExecuted;
      if (coverageEntry == null) {
        final int lineLength=line.trim().length();
        if (lengthCountdown > 0 && lineLength > 0) {
          lengthCountdown-=lineLength;
          timesLineExecuted=-1;
        }
 else {
          timesLineExecuted=data.hasStatement(lineNr) ? 0 : -1;
        }
      }
 else {
        timesLineExecuted=coverageEntry.intValue();
        lengthCountdown=data.getStatementLength(lineNr);
      }
      lineCoverageRecords.add(new LineCoverageRecord(lineCount,timesLineExecuted,line));
    }
    runStats.add(new FileStats(data.getSourceName(),lineCoverageRecords));
  }
  return runStats;
}

Fixed version (ground truth):
private RunStats collectAndWriteRunStats(final File test,final ScriptInstrumenter instrumenter,final NativeObject allCoverageData) throws IOException {
  final RunStats runStats=new RunStats(test);
  for (  final ScriptData data : instrumenter.getScriptDataList()) {
    final Scanner in=new Scanner(data.getSourceCode());
    final NativeObject coverageData=(NativeObject)allCoverageData.get(data.getSourceName());
    final List<LineCoverageRecord> lineCoverageRecords=Lists.newArrayList();
    for (int lineNr=1; lineNr < data.getLineNumberOfFirstStatement() && in.hasNext(); lineNr++) {
      lineCoverageRecords.add(new LineCoverageRecord(lineNr,-1,in.nextLine()));
    }
    for (int lineNr=data.getLineNumberOfFirstStatement(), lengthCountdown=0; in.hasNext(); lineNr++) {
      final String line=in.nextLine();
      final Double coverageEntry=(Double)coverageData.get(lineNr);
      final int timesLineExecuted;
      if (coverageEntry == null) {
        final int lineLength=line.trim().length();
        if (lengthCountdown > 0 && lineLength > 0) {
          lengthCountdown-=lineLength;
          timesLineExecuted=-1;
        }
 else {
          timesLineExecuted=data.hasStatement(lineNr) ? 0 : -1;
        }
      }
 else {
        timesLineExecuted=coverageEntry.intValue();
        lengthCountdown=data.getStatementLength(lineNr);
      }
      lineCoverageRecords.add(new LineCoverageRecord(lineNr,timesLineExecuted,line));
    }
    runStats.add(new FileStats(data.getSourceName(),lineCoverageRecords));
  }
  return runStats;
}
Program: 101277
Project: 101277
Buggy source:
private Block newInstrumentedBlock(final AstNode node){
  final Block block=new Block();
  block.addChild(node);
  block.addChildBefore(newInstrumentationNode(node.getLineno()),node);
  return block;
}

Fixed version (ground truth):
private Block newInstrumentedBlock(final AstNode node){
  final Block block=new Block();
  block.addChild(node);
  block.addChildBefore(newInstrumentationNode(getActualLineNumber(node)),node);
  return block;
}
Program: 101278
Project: 101278
Buggy source:
public InstrumentingVisitor(final ScriptData data){
  this.data=data;
}

Fixed version (ground truth):
public InstrumentingVisitor(final ScriptData data,final int lineNumberOffset){
  this.data=data;
  this.lineNumberOffset=lineNumberOffset;
}
Program: 101279
Project: 101279
Buggy source:
private void addInstrumentationSnippetFor(final AstNode node){
  final AstNode parent=node.getParent();
  final int type=node.getType();
  final int parentType=parent.getType();
  if (type == CASE) {
    handleSwitchCase((SwitchCase)node);
  }
 else   if (type == IF && parentType == IF) {
    flattenElseIf((IfStatement)node,(IfStatement)parent);
    data.addExecutableLine(node.getLineno(),node.getLength());
  }
 else   if (parentType != CASE) {
    if (parent.hasChildren()) {
      parent.addChildBefore(newInstrumentationNode(node.getLineno()),node);
    }
 else {
      final Block block=newInstrumentedBlock(node);
      if (parentType == IF) {
        final IfStatement ifStatement=(IfStatement)parent;
        if (ifStatement.getThenPart() == node) {
          ifStatement.setThenPart(block);
        }
 else         if (ifStatement.getElsePart() == node) {
          ifStatement.setElsePart(block);
        }
      }
 else       if (parentType == WHILE || parentType == FOR || parentType == DO) {
        ((Loop)parent).setBody(block);
      }
 else {
        logger.warn("String_Node_Str",parent.toSource());
      }
    }
    data.addExecutableLine(node.getLineno(),node.getLength());
  }
}

Fixed version (ground truth):
private void addInstrumentationSnippetFor(final AstNode node){
  final AstNode parent=node.getParent();
  final int type=node.getType();
  final int parentType=parent.getType();
  if (type == CASE) {
    handleSwitchCase((SwitchCase)node);
  }
 else   if (type == IF && parentType == IF) {
    flattenElseIf((IfStatement)node,(IfStatement)parent);
    data.addExecutableLine(getActualLineNumber(node),node.getLength());
  }
 else   if (parentType != CASE) {
    if (parent.hasChildren()) {
      parent.addChildBefore(newInstrumentationNode(getActualLineNumber(node)),node);
    }
 else {
      final Block block=newInstrumentedBlock(node);
      if (parentType == IF) {
        final IfStatement ifStatement=(IfStatement)parent;
        if (ifStatement.getThenPart() == node) {
          ifStatement.setThenPart(block);
        }
 else         if (ifStatement.getElsePart() == node) {
          ifStatement.setElsePart(block);
        }
      }
 else       if (parentType == WHILE || parentType == FOR || parentType == DO) {
        ((Loop)parent).setBody(block);
      }
 else {
        logger.warn("String_Node_Str",parent.toSource());
      }
    }
    data.addExecutableLine(getActualLineNumber(node),node.getLength());
  }
}
Program: 101280
Project: 101280
Buggy source:
/** 
 * 'switch' statement cases are special in the sense that their children are not actually their children, meaning the children have a reference to their parent, but the parent only has a List of all its children, so we can't just addChildBefore() like we do for all other cases. They do, however, retain a list of all statements per each case, which we're using here
 */
private void handleSwitchCase(final SwitchCase switchCase){
  if (switchCase.getStatements() == null) {
    return;
  }
  final List<AstNode> newStatements=Lists.newArrayList();
  for (  final AstNode statement : switchCase.getStatements()) {
    final int lineNr=statement.getLineno();
    data.addExecutableLine(lineNr,switchCase.getLength());
    newStatements.add(newInstrumentationNode(lineNr));
    newStatements.add(statement);
  }
  switchCase.setStatements(newStatements);
}

Fixed version (ground truth):
/** 
 * 'switch' statement cases are special in the sense that their children are not actually their children, meaning the children have a reference to their parent, but the parent only has a List of all its children, so we can't just addChildBefore() like we do for all other cases. They do, however, retain a list of all statements per each case, which we're using here
 */
private void handleSwitchCase(final SwitchCase switchCase){
  if (switchCase.getStatements() == null) {
    return;
  }
  final List<AstNode> newStatements=Lists.newArrayList();
  for (  final AstNode statement : switchCase.getStatements()) {
    final int lineNr=getActualLineNumber(statement);
    data.addExecutableLine(lineNr,switchCase.getLength());
    newStatements.add(newInstrumentationNode(lineNr));
    newStatements.add(statement);
  }
  switchCase.setStatements(newStatements);
}
Program: 101282
Project: 101282
Buggy source:
/** 
 * In order to make it possible to cover else-if blocks, we're flattening the shorthand else-if <pre>  {@literal}if (cond1)  doIf(); } else if (cond2) { doElseIf(); } else { doElse(); } } </pre> into <pre>  {@literal}if (cond1)  doIf(); } else { if (cond2) { doElseIf(); } else { doElse(); } } } </pre>
 */
private void flattenElseIf(final IfStatement elseIfStatement,final IfStatement ifStatement){
  final Block block=new Block();
  block.addChild(elseIfStatement);
  ifStatement.setElsePart(block);
  final int lineNr=elseIfStatement.getLineno();
  data.addExecutableLine(lineNr,elseIfStatement.getLength());
  block.addChildBefore(newInstrumentationNode(lineNr),elseIfStatement);
}

Fixed version (ground truth):
/** 
 * In order to make it possible to cover else-if blocks, we're flattening the shorthand else-if <pre>  {@literal}if (cond1)  doIf(); } else if (cond2) { doElseIf(); } else { doElse(); } } </pre> into <pre>  {@literal}if (cond1)  doIf(); } else { if (cond2) { doElseIf(); } else { doElse(); } } } </pre>
 */
private void flattenElseIf(final IfStatement elseIfStatement,final IfStatement ifStatement){
  final Block block=new Block();
  block.addChild(elseIfStatement);
  ifStatement.setElsePart(block);
  final int lineNr=getActualLineNumber(elseIfStatement);
  data.addExecutableLine(lineNr,elseIfStatement.getLength());
  block.addChildBefore(newInstrumentationNode(lineNr),elseIfStatement);
}
Program: 101283
Project: 101283
Buggy source:
public void execute() throws MojoExecutionException {
  final CoverageGenerator gen=new CoverageGenerator(baseDir,includes,excludes,outputDir);
  gen.setOutputInstrumentedFiles(outputInstrumentedFiles);
  gen.setCacheInstrumentedCode(cacheInstrumentedCode);
  gen.setNoInstrumentPatterns(ImmutableList.copyOf(noInstrumentPatterns));
  gen.setOutputStrategy(outputStrategy);
  gen.setThreadCount(threadCount);
  try {
    gen.run();
  }
 catch (  final IOException e) {
    throw new MojoExecutionException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void execute() throws MojoExecutionException {
  final CoverageGenerator gen=new CoverageGenerator(baseDir,includes,excludes,outputDir);
  gen.setOutputInstrumentedFiles(outputInstrumentedFiles);
  gen.setCacheInstrumentedCode(cacheInstrumentedCode);
  gen.setNoInstrumentPatterns(noInstrumentPatterns);
  gen.setOutputStrategy(outputStrategy);
  gen.setThreadCount(threadCount);
  try {
    gen.run();
  }
 catch (  final IOException e) {
    throw new MojoExecutionException("String_Node_Str",e);
  }
}
Program: 101284
Project: 101284
Buggy source:
public CoverageGenerator(final File baseDir,final String includes,final String excludes,final File outputDir){
  this.baseDir=baseDir;
  this.includes=includes;
  this.excludes=excludes;
  this.outputDir=outputDir;
  stringTemplateGroup=new STGroupDir("String_Node_Str",'$','$');
}

Fixed version (ground truth):
public CoverageGenerator(final File baseDir,final String includes,final String excludes,final File outputDir){
  Validate.isTrue(baseDir.exists(),"String_Node_Str");
  this.baseDir=baseDir;
  this.includes=includes;
  this.excludes=excludes;
  this.outputDir=outputDir;
  stringTemplateGroup=new STGroupDir("String_Node_Str",'$','$');
}
Program: 101285
Project: 101285
Buggy source:
public void execute() throws MojoExecutionException {
  final CoverageGenerator gen=new CoverageGenerator(baseDir,includes,excludes,outputDir);
  gen.setOutputInstrumentedFiles(outputInstrumentedFiles);
  gen.setCacheInstrumentedCode(cacheInstrumentedCode);
  gen.setNoInstrumentPatterns(noInstrumentPatterns);
  gen.setOutputStrategy(outputStrategy);
  gen.setThreadCount(threadCount);
  try {
    gen.run();
  }
 catch (  final IOException e) {
    throw new MojoExecutionException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void execute() throws MojoExecutionException {
  try {
    final CoverageGenerator gen=new CoverageGenerator(baseDir,includes,excludes,outputDir);
    gen.setOutputInstrumentedFiles(outputInstrumentedFiles);
    gen.setCacheInstrumentedCode(cacheInstrumentedCode);
    gen.setNoInstrumentPatterns(noInstrumentPatterns);
    gen.setOutputStrategy(outputStrategy);
    gen.setThreadCount(threadCount);
    try {
      gen.run();
    }
 catch (    final IOException e) {
      throw new MojoExecutionException("String_Node_Str",e);
    }
  }
 catch (  final IllegalArgumentException e) {
    throw new MojoExecutionException("String_Node_Str",e);
  }
}
Program: 101286
Project: 101286
Buggy source:
private RunStats collectAndWriteRunStats(final File test,final ScriptInstrumenter instrumenter,final NativeObject allCoverageData) throws IOException {
  final RunStats runStats=new RunStats(test);
  for (  final ScriptData data : instrumenter.getScriptDataList()) {
    final Scanner in=new Scanner(data.getSourceCode());
    final NativeObject coverageData=(NativeObject)allCoverageData.get(data.getSourceName());
    final String jsFileName=data.getSourceName();
    final List<LineCoverageRecord> lineCoverageRecords=Lists.newArrayList();
    for (int lineCount=1, lineNr=data.getLineNumberOfFirstStatement(), lengthCountdown=0; in.hasNext(); lineCount++, lineNr++) {
      final String line=in.nextLine();
      final Double coverageEntry=(Double)coverageData.get(lineNr);
      final int timesLineExecuted;
      if (coverageEntry == null) {
        final int lineLength=line.trim().length();
        if (lengthCountdown > 0 && lineLength > 0) {
          lengthCountdown-=lineLength;
          timesLineExecuted=-1;
        }
 else {
          timesLineExecuted=data.hasStatement(lineNr) ? 0 : -1;
        }
      }
 else {
        timesLineExecuted=coverageEntry.intValue();
        lengthCountdown=data.getStatementLength(lineNr);
      }
      lineCoverageRecords.add(new LineCoverageRecord(lineCount,timesLineExecuted,line));
    }
    try {
      final String name=jsFileName.startsWith("String_Node_Str") ? jsFileName : new URI(jsFileName).normalize().toString();
      runStats.add(new FileStats(name,lineCoverageRecords));
    }
 catch (    final URISyntaxException e) {
      throw new RuntimeException(e);
    }
  }
  return runStats;
}

Fixed version (ground truth):
private RunStats collectAndWriteRunStats(final File test,final ScriptInstrumenter instrumenter,final NativeObject allCoverageData) throws IOException {
  final RunStats runStats=new RunStats(test);
  for (  final ScriptData data : instrumenter.getScriptDataList()) {
    final Scanner in=new Scanner(data.getSourceCode());
    final NativeObject coverageData=(NativeObject)allCoverageData.get(data.getSourceName());
    final List<LineCoverageRecord> lineCoverageRecords=Lists.newArrayList();
    for (int lineCount=1, lineNr=data.getLineNumberOfFirstStatement(), lengthCountdown=0; in.hasNext(); lineCount++, lineNr++) {
      final String line=in.nextLine();
      final Double coverageEntry=(Double)coverageData.get(lineNr);
      final int timesLineExecuted;
      if (coverageEntry == null) {
        final int lineLength=line.trim().length();
        if (lengthCountdown > 0 && lineLength > 0) {
          lengthCountdown-=lineLength;
          timesLineExecuted=-1;
        }
 else {
          timesLineExecuted=data.hasStatement(lineNr) ? 0 : -1;
        }
      }
 else {
        timesLineExecuted=coverageEntry.intValue();
        lengthCountdown=data.getStatementLength(lineNr);
      }
      lineCoverageRecords.add(new LineCoverageRecord(lineCount,timesLineExecuted,line));
    }
    runStats.add(new FileStats(data.getSourceName(),lineCoverageRecords));
  }
  return runStats;
}
Program: 101287
Project: 101287
Buggy source:
FileStats(final String fullName,final List<LineCoverageRecord> lineCoverageRecords){
  this.fullName=fullName;
  final File file=new File(fullName);
  fileName=file.getName();
  parentName=file.getParent();
  this.id=generateId();
  this.lineCoverageRecords=lineCoverageRecords;
}

Fixed version (ground truth):
FileStats(final String fullName,final List<LineCoverageRecord> lineCoverageRecords){
  this.fullName=fullName;
  this.relativeName=getRelativeName(fullName);
  final File file=new File(relativeName);
  fileName=file.getName();
  parentName=file.getParent();
  this.id=generateId();
  this.lineCoverageRecords=lineCoverageRecords;
}