Program: 101262
Project: 101262
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();
    if (!data.getLineNumbersOfAllStatements().isEmpty()) {
      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;
}

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();
    if (!data.getLineNumbersOfAllStatements().isEmpty()) {
      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));
      }
    }
 else {
      for (int lineNr=1; in.hasNext(); lineNr++) {
        lineCoverageRecords.add(new LineCoverageRecord(lineNr,-1,in.nextLine()));
      }
    }
    runStats.add(new FileStats(data.getSourceName(),lineCoverageRecords));
  }
  return runStats;
}