nus-yam/ex-repair huggingface dataset:
Program: 47994
Project: 47994
Buggy source:
/** 
 * Getter of the total of block coverage.
 * @return float the total of block coverage.
 */
public float getTotalComplexityScore(){
  if (this.getCoverageResults().size() <= 0) {
    return 0.0f;
  }
  float totalComplex=this.getComplexityScore() / this.getCoverageResults().size();
  totalComplex=Utils.roundFLoat(1,BigDecimal.ROUND_HALF_EVEN,totalComplex);
  return totalComplex;
}

Fixed version (ground truth):
/** 
 * Getter of the total of block coverage.
 * @return float the total of block coverage.
 */
public float getTotalComplexityScore(){
  if (this.getCoverageResults().size() <= 0) {
    return 0.0f;
  }
  float totalComplex=this.getComplexityScore() / this.getCoverageResults().size();
  totalComplex=Utils.roundFloat(1,RoundingMode.HALF_EVEN,totalComplex);
  return totalComplex;
}
Program: 47995
Project: 47995
Buggy source:
/** 
 * Getter of the total of line coverage.
 * @return float the total of line coverage.
 */
public float getTotalLineCoverage(){
  if (this.getCoverageResults().size() <= 0) {
    return 0.0f;
  }
  float totalLine=this.getLineCoverage() / this.getCoverageResults().size();
  totalLine=Utils.roundFLoat(1,BigDecimal.ROUND_HALF_EVEN,totalLine);
  return totalLine;
}

Fixed version (ground truth):
/** 
 * Getter of the total of line coverage.
 * @return float the total of line coverage.
 */
public float getTotalLineCoverage(){
  if (this.getCoverageResults().size() <= 0) {
    return 0.0f;
  }
  float totalLine=this.getLineCoverage() / this.getCoverageResults().size();
  totalLine=Utils.roundFloat(1,RoundingMode.HALF_EVEN,totalLine);
  return totalLine;
}
Program: 47996
Project: 47996
Buggy source:
/** 
 * Getter of the total of method coverage.
 * @return float the total of method coverage.
 */
public float getTotalMethodCoverage(){
  if (this.getCoverageResults().size() <= 0) {
    return 0.0f;
  }
  float totalMethod=this.getMethodCoverage() / this.getCoverageResults().size();
  totalMethod=Utils.roundFLoat(1,BigDecimal.ROUND_HALF_EVEN,totalMethod);
  return totalMethod;
}

Fixed version (ground truth):
/** 
 * Getter of the total of method coverage.
 * @return float the total of method coverage.
 */
public float getTotalMethodCoverage(){
  if (this.getCoverageResults().size() <= 0) {
    return 0.0f;
  }
  float totalMethod=this.getMethodCoverage() / this.getCoverageResults().size();
  totalMethod=Utils.roundFloat(1,RoundingMode.HALF_EVEN,totalMethod);
  return totalMethod;
}
Program: 47997
Project: 47997
Buggy source:
/** 
 * Getter of the total of block coverage.
 * @return float the total of block coverage.
 */
public float getTotalBranchCoverage(){
  if (this.getCoverageResults().size() <= 0) {
    return 0.0f;
  }
  float totalBranch=this.getBranchCoverage() / this.getCoverageResults().size();
  totalBranch=Utils.roundFLoat(1,BigDecimal.ROUND_HALF_EVEN,totalBranch);
  return totalBranch;
}

Fixed version (ground truth):
/** 
 * Getter of the total of block coverage.
 * @return float the total of block coverage.
 */
public float getTotalBranchCoverage(){
  if (this.getCoverageResults().size() <= 0) {
    return 0.0f;
  }
  float totalBranch=this.getBranchCoverage() / this.getCoverageResults().size();
  totalBranch=Utils.roundFloat(1,RoundingMode.HALF_EVEN,totalBranch);
  return totalBranch;
}
Program: 47998
Project: 47998
Buggy source:
/** 
 * Getter of the total of class coverage.
 * @return float the total of class coverage.
 */
public float getTotalClassCoverage(){
  if (this.getCoverageResults().size() <= 0) {
    return 0.0f;
  }
  float totalClass=this.getClassCoverage() / this.getCoverageResults().size();
  totalClass=Utils.roundFLoat(1,BigDecimal.ROUND_HALF_EVEN,totalClass);
  return totalClass;
}

Fixed version (ground truth):
/** 
 * Getter of the total of class coverage.
 * @return float the total of class coverage.
 */
public float getTotalClassCoverage(){
  if (this.getCoverageResults().size() <= 0) {
    return 0.0f;
  }
  float totalClass=this.getClassCoverage() / this.getCoverageResults().size();
  totalClass=Utils.roundFloat(1,RoundingMode.HALF_EVEN,totalClass);
  return totalClass;
}
Program: 47999
Project: 47999
Buggy source:
/** 
 * This method will be called by portlet.jelly to load data and create the chart.
 * @return Graph a summary graph
 */
public Graph getSummaryGraph(){
  Map<LocalDate,JacocoCoverageResultSummary> summaries;
  List<Job> jobs=getDashboard().getJobs();
  summaries=JacocoLoadData.loadChartDataWithinRange(jobs,daysNumber);
  return createTrendChart(summaries,width,height);
}

Fixed version (ground truth):
/** 
 * This method will be called by portlet.jelly to load data and create the chart.
 * @return Graph a summary graph
 */
public Graph getSummaryGraph(){
  Map<LocalDate,JacocoCoverageResultSummary> summaries;
  @SuppressWarnings({"String_Node_Str","String_Node_Str"}) List<Job<?,?>> jobs=(List)getDashboard().getJobs();
  summaries=JacocoLoadData.loadChartDataWithinRange(jobs,daysNumber);
  return createTrendChart(summaries,width,height);
}
Program: 48001
Project: 48001
Buggy source:
protected String resolveFilePaths(Run<?,?> build,TaskListener listener,String input){
  try {
    return build.getEnvironment(listener).expand(input);
  }
 catch (  Exception e) {
    listener.getLogger().println("String_Node_Str" + input + "String_Node_Str"+ e.getMessage());
  }
  return input;
}

Fixed version (ground truth):
protected String resolveFilePaths(AbstractBuild<?,?> build,TaskListener listener,String input){
  try {
    final EnvVars environment=build.getEnvironment(listener);
    environment.overrideAll(build.getBuildVariables());
    return environment.expand(input);
  }
 catch (  Exception e) {
    listener.getLogger().println("String_Node_Str" + input + "String_Node_Str"+ e.getMessage());
  }
  return input;
}
Program: 48003
Project: 48003
Buggy source:
@Test public void test() throws Exception {
  AbstractReport<ClassReport,MethodReport> report=new AbstractReport<ClassReport,MethodReport>(){
  }
;
  assertNotNull(report);
  report.setParent(new ClassReport());
  report.getParent().setParent(new PackageReport());
  TaskListener taskListener=new TaskListener(){
    public PrintStream getLogger(){
      return null;
    }
    public void annotate(    ConsoleNote consoleNote) throws IOException {
    }
    public void hyperlink(    String s,    String s1) throws IOException {
    }
    public PrintWriter error(    String s){
      return null;
    }
    public PrintWriter error(    String s,    Object... objects){
      return null;
    }
    public PrintWriter fatalError(    String s){
      return null;
    }
    public PrintWriter fatalError(    String s,    Object... objects){
      return null;
    }
  }
;
  JacocoBuildAction action=new JacocoBuildAction(null,null,taskListener,null,null);
  report.getParent().getParent().setParent(new CoverageReport(action,null));
  assertNull(report.getBuild());
  assertNull(report.getName());
  assertNull(report.getDisplayName());
  report.setName("String_Node_Str");
  assertEquals("String_Node_Str",report.getName());
  assertEquals("String_Node_Str",report.getDisplayName());
}

Fixed version (ground truth):
@Test public void test() throws Exception {
  AbstractReport<ClassReport,MethodReport> report=new AbstractReport<ClassReport,MethodReport>(){
  }
;
  assertNotNull(report);
  report.setParent(new ClassReport());
  report.getParent().setParent(new PackageReport());
  TaskListener taskListener=StreamTaskListener.fromStdout();
  JacocoBuildAction action=new JacocoBuildAction(null,null,taskListener,null,null);
  report.getParent().getParent().setParent(new CoverageReport(action,null));
  assertNull(report.getBuild());
  assertNull(report.getName());
  assertNull(report.getDisplayName());
  report.setName("String_Node_Str");
  assertEquals("String_Node_Str",report.getName());
  assertEquals("String_Node_Str",report.getDisplayName());
}
Program: 48004
Project: 48004
Buggy source:
@Test public void testGetPercentWithBuildAndAction(){
  ServletContext context=EasyMock.createNiceMock(ServletContext.class);
  EasyMock.replay(context);
  final Job<?,?> mockJob=new MyJob("String_Node_Str"){
    @Override @Exported @QuickSilver public Run<?,?> getLastSuccessfulBuild(){
      try {
        Run<?,?> newBuild=newBuild();
        newBuild.getActions().add(new JacocoBuildAction(null,null,new TaskListener(){
          private static final long serialVersionUID=1L;
          public void hyperlink(          String url,          String text) throws IOException {
          }
          public PrintStream getLogger(){
            return null;
          }
          public PrintWriter fatalError(          String format,          Object... args){
            return null;
          }
          public PrintWriter fatalError(          String msg){
            return null;
          }
          public PrintWriter error(          String format,          Object... args){
            return null;
          }
          public PrintWriter error(          String msg){
            return null;
          }
          public void annotate(          @SuppressWarnings("String_Node_Str") ConsoleNote ann) throws IOException {
          }
          public void started(          List<Cause> causes){
          }
          public void finished(          Result result){
          }
        }
,null,null));
        assertEquals(1,newBuild.getActions().size());
        return newBuild;
      }
 catch (      IOException e) {
        throw new IllegalStateException(e);
      }
    }
    @Override protected synchronized void saveNextBuildNumber() throws IOException {
    }
  }
;
  assertTrue(jacocoColumn.hasCoverage(mockJob));
  assertEquals("String_Node_Str",jacocoColumn.getPercent(mockJob));
  assertEquals(new BigDecimal("String_Node_Str"),jacocoColumn.getLineCoverage(mockJob));
  EasyMock.verify(context);
}

Fixed version (ground truth):
@Test public void testGetPercentWithBuildAndAction(){
  ServletContext context=EasyMock.createNiceMock(ServletContext.class);
  EasyMock.replay(context);
  final Job<?,?> mockJob=new MyJob("String_Node_Str"){
    @Override @Exported @QuickSilver public Run<?,?> getLastSuccessfulBuild(){
      try {
        Run<?,?> newBuild=newBuild();
        newBuild.getActions().add(new JacocoBuildAction(null,null,StreamTaskListener.fromStdout(),null,null));
        assertEquals(1,newBuild.getActions().size());
        return newBuild;
      }
 catch (      IOException e) {
        throw new IllegalStateException(e);
      }
    }
    @Override protected synchronized void saveNextBuildNumber() throws IOException {
    }
  }
;
  assertTrue(jacocoColumn.hasCoverage(mockJob));
  assertEquals("String_Node_Str",jacocoColumn.getPercent(mockJob));
  assertEquals(new BigDecimal("String_Node_Str"),jacocoColumn.getLineCoverage(mockJob));
  EasyMock.verify(context);
}
Program: 48006
Project: 48006
Buggy source:
public RESULT getResultByTypeAndRatio(Coverage ratio){
  RESULT result=RESULT.ABOVEMAXIMUM;
  Type covType=ratio.getType();
  if (covType == Type.INSTRUCTION) {
    if (ratio.getPercentageFloat() < minInstruction) {
      result=RESULT.BELLOWMINIMUM;
    }
 else     if (ratio.getPercentageFloat() < maxInstruction) {
      result=RESULT.BETWEENMINMAX;
    }
  }
 else   if (covType == Type.BRANCH) {
    if (ratio.getPercentageFloat() < minBranch) {
      result=RESULT.BELLOWMINIMUM;
    }
 else     if (ratio.getPercentageFloat() < maxBranch) {
      result=RESULT.BETWEENMINMAX;
    }
  }
 else   if (covType == Type.LINE) {
    if (ratio.getPercentageFloat() < minLine) {
      result=RESULT.BELLOWMINIMUM;
    }
 else     if (ratio.getPercentageFloat() < maxLine) {
      result=RESULT.BETWEENMINMAX;
    }
  }
 else   if (covType == Type.COMPLEXITY) {
    if (ratio.getPercentageFloat() < minComplexity) {
      result=RESULT.BELLOWMINIMUM;
    }
 else     if (ratio.getPercentageFloat() < maxComplexity) {
      result=RESULT.BETWEENMINMAX;
    }
  }
 else   if (covType == Type.METHOD) {
    if (ratio.getPercentageFloat() < minMethod) {
      result=RESULT.BELLOWMINIMUM;
    }
 else     if (ratio.getPercentageFloat() < maxMethod) {
      result=RESULT.BETWEENMINMAX;
    }
  }
 else   if (covType == Type.CLASS) {
    if (ratio.getPercentageFloat() < minClass) {
      result=RESULT.BELLOWMINIMUM;
    }
 else     if (ratio.getPercentageFloat() < maxClass) {
      result=RESULT.BETWEENMINMAX;
    }
  }
  return result;
}

Fixed version (ground truth):
public RESULT getResultByTypeAndRatio(Coverage ratio){
  RESULT result=RESULT.ABOVEMAXIMUM;
  Type covType=ratio.getType();
  if (covType == Type.INSTRUCTION) {
    if (ratio.getPercentageFloat() < minInstruction) {
      result=RESULT.BELOWMINIMUM;
    }
 else     if (ratio.getPercentageFloat() < maxInstruction) {
      result=RESULT.BETWEENMINMAX;
    }
  }
 else   if (covType == Type.BRANCH) {
    if (ratio.getPercentageFloat() < minBranch) {
      result=RESULT.BELOWMINIMUM;
    }
 else     if (ratio.getPercentageFloat() < maxBranch) {
      result=RESULT.BETWEENMINMAX;
    }
  }
 else   if (covType == Type.LINE) {
    if (ratio.getPercentageFloat() < minLine) {
      result=RESULT.BELOWMINIMUM;
    }
 else     if (ratio.getPercentageFloat() < maxLine) {
      result=RESULT.BETWEENMINMAX;
    }
  }
 else   if (covType == Type.COMPLEXITY) {
    if (ratio.getPercentageFloat() < minComplexity) {
      result=RESULT.BELOWMINIMUM;
    }
 else     if (ratio.getPercentageFloat() < maxComplexity) {
      result=RESULT.BETWEENMINMAX;
    }
  }
 else   if (covType == Type.METHOD) {
    if (ratio.getPercentageFloat() < minMethod) {
      result=RESULT.BELOWMINIMUM;
    }
 else     if (ratio.getPercentageFloat() < maxMethod) {
      result=RESULT.BETWEENMINMAX;
    }
  }
 else   if (covType == Type.CLASS) {
    if (ratio.getPercentageFloat() < minClass) {
      result=RESULT.BELOWMINIMUM;
    }
 else     if (ratio.getPercentageFloat() < maxClass) {
      result=RESULT.BETWEENMINMAX;
    }
  }
  return result;
}
Program: 48007
Project: 48007
Buggy source:
@Override protected void printRatioCell(boolean failed,Coverage ratio,StringBuilder buf){
  if (ratio != null && ratio.isInitialized()) {
    String bgColor="String_Node_Str";
    if (JacocoHealthReportThresholds.RESULT.BETWEENMINMAX == healthReports.getResultByTypeAndRatio(ratio)) {
      bgColor="String_Node_Str";
    }
 else     if (JacocoHealthReportThresholds.RESULT.BELLOWMINIMUM == healthReports.getResultByTypeAndRatio(ratio)) {
      bgColor="String_Node_Str";
    }
    buf.append("String_Node_Str").append(bgColor).append("String_Node_Str");
    buf.append("String_Node_Str").append(dataFormat.format(ratio.getPercentageFloat()));
    buf.append("String_Node_Str");
    printRatioTable(ratio,buf);
    buf.append("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override protected void printRatioCell(boolean failed,Coverage ratio,StringBuilder buf){
  if (ratio != null && ratio.isInitialized()) {
    String bgColor="String_Node_Str";
    if (JacocoHealthReportThresholds.RESULT.BETWEENMINMAX == healthReports.getResultByTypeAndRatio(ratio)) {
      bgColor="String_Node_Str";
    }
 else     if (JacocoHealthReportThresholds.RESULT.BELOWMINIMUM == healthReports.getResultByTypeAndRatio(ratio)) {
      bgColor="String_Node_Str";
    }
    buf.append("String_Node_Str").append(bgColor).append("String_Node_Str");
    buf.append("String_Node_Str").append(dataFormat.format(ratio.getPercentageFloat()));
    buf.append("String_Node_Str");
    printRatioTable(ratio,buf);
    buf.append("String_Node_Str");
  }
}
Program: 48009
Project: 48009
Buggy source:
/** 
 * Constructor with parameters.
 * @param job the related Job
 * @param blockCoverage block coverage percentage
 * @param lineCoverage line coverage percentage
 * @param methodCoverage method coverage percentage
 * @param classCoverage coverage percentage
 */
public JacocoCoverageResultSummary(Job<?,?> job,float lineCoverage,float methodCoverage,float classCoverage,float branchCoverage,float instructionCoverage,float complexityScore){
  this.job=job;
  this.lineCoverage=lineCoverage;
  this.methodCoverage=methodCoverage;
  this.classCoverage=classCoverage;
  this.branchCoverage=branchCoverage;
  this.instructionCoverage=instructionCoverage;
  this.complexityScore=complexityScore;
}

Fixed version (ground truth):
/** 
 * Constructor with parameters.
 * @param job the related Job
 * @param lineCoverage line coverage percentage
 * @param methodCoverage method coverage percentage
 * @param classCoverage coverage percentage
 */
public JacocoCoverageResultSummary(Job<?,?> job,float lineCoverage,float methodCoverage,float classCoverage,float branchCoverage,float instructionCoverage,float complexityScore){
  this.job=job;
  this.lineCoverage=lineCoverage;
  this.methodCoverage=methodCoverage;
  this.classCoverage=classCoverage;
  this.branchCoverage=branchCoverage;
  this.instructionCoverage=instructionCoverage;
  this.complexityScore=complexityScore;
}
Program: 48011
Project: 48011
Buggy source:
public FilePath[] invoke(File f,VirtualChannel channel) throws IOException {
  FilePath base=new FilePath(f);
  ArrayList<FilePath> localDirectoryPaths=new ArrayList<FilePath>();
  String[] includes=input.split("String_Node_Str");
  DirectoryScanner ds=new DirectoryScanner();
  ds.setIncludes(includes);
  ds.setCaseSensitive(false);
  ds.setBasedir(f);
  ds.scan();
  String[] dirs=ds.getIncludedDirectories();
  for (  String dir : dirs) {
    localDirectoryPaths.add(base.child(dir));
  }
  FilePath[] lfp={};
  return localDirectoryPaths.toArray(lfp);
}

Fixed version (ground truth):
public FilePath[] invoke(File f,VirtualChannel channel) throws IOException {
  FilePath base=new FilePath(f);
  ArrayList<FilePath> localDirectoryPaths=new ArrayList<FilePath>();
  String[] includes=input.split(DIR_SEP);
  DirectoryScanner ds=new DirectoryScanner();
  ds.setIncludes(includes);
  ds.setCaseSensitive(false);
  ds.setBasedir(f);
  ds.scan();
  String[] dirs=ds.getIncludedDirectories();
  for (  String dir : dirs) {
    localDirectoryPaths.add(base.child(dir));
  }
  FilePath[] lfp={};
  return localDirectoryPaths.toArray(lfp);
}
Program: 48012
Project: 48012
Buggy source:
protected static FilePath[] resolveDirPaths(AbstractBuild<?,?> build,BuildListener listener,final String input){
  FilePath[] directoryPaths=null;
  try {
    directoryPaths=build.getWorkspace().act(new FilePath.FileCallable<FilePath[]>(){
      static final long serialVersionUID=1552178457453558870L;
      public FilePath[] invoke(      File f,      VirtualChannel channel) throws IOException {
        FilePath base=new FilePath(f);
        ArrayList<FilePath> localDirectoryPaths=new ArrayList<FilePath>();
        String[] includes=input.split("String_Node_Str");
        DirectoryScanner ds=new DirectoryScanner();
        ds.setIncludes(includes);
        ds.setCaseSensitive(false);
        ds.setBasedir(f);
        ds.scan();
        String[] dirs=ds.getIncludedDirectories();
        for (        String dir : dirs) {
          localDirectoryPaths.add(base.child(dir));
        }
        FilePath[] lfp={};
        return localDirectoryPaths.toArray(lfp);
      }
    }
);
  }
 catch (  InterruptedException ie) {
    ie.printStackTrace();
  }
catch (  IOException io) {
    io.printStackTrace();
  }
  return directoryPaths;
}

Fixed version (ground truth):
protected static FilePath[] resolveDirPaths(AbstractBuild<?,?> build,BuildListener listener,final String input){
  FilePath[] directoryPaths=null;
  try {
    directoryPaths=build.getWorkspace().act(new FilePath.FileCallable<FilePath[]>(){
      static final long serialVersionUID=1552178457453558870L;
      public FilePath[] invoke(      File f,      VirtualChannel channel) throws IOException {
        FilePath base=new FilePath(f);
        ArrayList<FilePath> localDirectoryPaths=new ArrayList<FilePath>();
        String[] includes=input.split(DIR_SEP);
        DirectoryScanner ds=new DirectoryScanner();
        ds.setIncludes(includes);
        ds.setCaseSensitive(false);
        ds.setBasedir(f);
        ds.scan();
        String[] dirs=ds.getIncludedDirectories();
        for (        String dir : dirs) {
          localDirectoryPaths.add(base.child(dir));
        }
        FilePath[] lfp={};
        return localDirectoryPaths.toArray(lfp);
      }
    }
);
  }
 catch (  InterruptedException ie) {
    ie.printStackTrace();
  }
catch (  IOException io) {
    io.printStackTrace();
  }
  return directoryPaths;
}
Program: 48015
Project: 48015
Buggy source:
protected void printRatioCell(boolean failed,Coverage ratio,StringBuilder buf){
  if (ratio != null && ratio.isInitialized()) {
    String className="String_Node_Str" + (failed ? "String_Node_Str" : "String_Node_Str");
    buf.append("String_Node_Str").append(className).append("String_Node_Str");
    buf.append("String_Node_Str").append(dataFormat.format(ratio.getPercentageFloat()));
    buf.append("String_Node_Str");
    printRatioTable(ratio,buf);
    buf.append("String_Node_Str");
  }
}

Fixed version (ground truth):
protected void printRatioCell(boolean failed,Coverage ratio,StringBuilder buf){
  if (ratio != null && ratio.isInitialized()) {
    buf.append("String_Node_Str").append("String_Node_Str").append("String_Node_Str");
    buf.append("String_Node_Str").append(dataFormat.format(ratio.getPercentageFloat()));
    buf.append("String_Node_Str");
    printRatioTable(ratio,buf);
    buf.append("String_Node_Str");
  }
}
Program: 48016
Project: 48016
Buggy source:
/** 
 * Adds the given missed and covered values to the ones already contained in this ratio.
 * @param missed The amount to add to the missed.
 * @param covered The amount to add to the covered.
 */
public void accumulate(int missed,int covered){
  this.missed+=missed;
  this.covered+=covered;
  initialized=true;
}

Fixed version (ground truth):
/** 
 * Adds the given missed and covered values to the ones already contained in this ratio.
 * @param missed The amount to add to the missed.
 * @param covered The amount to add to the covered.
 */
public void accumulate(int missed,int covered){
  this.missed=missed;
  this.covered=covered;
  initialized=true;
}
Program: 48017
Project: 48017
Buggy source:
@Test public void testPackageReport() throws Exception {
  CoverageReport r=new CoverageReport(null,getClass().getResourceAsStream("String_Node_Str"));
  PackageReport pkg=r.getChildren().get("String_Node_Str");
  assertCoverage(pkg.getLineCoverage(),68,82);
}

Fixed version (ground truth):
@Test public void testPackageReport() throws Exception {
  CoverageReport r=new CoverageReport(null,getClass().getResourceAsStream("String_Node_Str"));
  PackageReport pkg=r.getChildren().get("String_Node_Str");
  assertCoverage(pkg.getLineCoverage(),34,41);
}
Program: 48018
Project: 48018
Buggy source:
/** 
 * Ensures the coverage after loading two reports represents the combined metrics of both reports.
 */
@Test public void testLoadMultipleReports() throws Exception {
  CoverageReport r=new CoverageReport(null,getClass().getResourceAsStream("String_Node_Str"),getClass().getResourceAsStream("String_Node_Str"));
  assertCoverage(r.getLineCoverage(),595 + 513,293 + 361);
  PackageReport pkg=r.getChildren().get("String_Node_Str");
  assertCoverage(pkg.getLineCoverage(),68,82);
  pkg=r.getChildren().get("String_Node_Str");
  assertCoverage(pkg.getLineCoverage(),136,0 + 2);
}

Fixed version (ground truth):
/** 
 * Ensures the coverage after loading two reports represents the combined metrics of both reports.
 */
@Test public void testLoadMultipleReports() throws Exception {
  CoverageReport r=new CoverageReport(null,getClass().getResourceAsStream("String_Node_Str"),getClass().getResourceAsStream("String_Node_Str"));
  assertCoverage(r.getLineCoverage(),513,361);
  PackageReport pkg=r.getChildren().get("String_Node_Str");
  assertCoverage(pkg.getLineCoverage(),34,41);
  pkg=r.getChildren().get("String_Node_Str");
  assertCoverage(pkg.getLineCoverage(),68,1);
}
Program: 48019
Project: 48019
Buggy source:
@Test public void testLoad() throws Exception {
  CoverageReport r=new CoverageReport(null,getClass().getResourceAsStream("String_Node_Str"));
  PackageReport pkg=r.getChildren().get("String_Node_Str");
  System.out.println(pkg);
  assertCoverage(pkg.getLineCoverage(),786,392);
  assertEquals(595,r.getLineCoverage().getMissed());
}

Fixed version (ground truth):
@Test public void testLoad() throws Exception {
  CoverageReport r=new CoverageReport(null,getClass().getResourceAsStream("String_Node_Str"));
  PackageReport pkg=r.getChildren().get("String_Node_Str");
  System.out.println(pkg);
  assertCoverage(pkg.getLineCoverage(),393,196);
  assertEquals(595,r.getLineCoverage().getMissed());
}
Program: 48020
Project: 48020
Buggy source:
@Test public void testLoadMultipleReports() throws Exception {
  JacocoBuildAction r=JacocoBuildAction.load(null,null,new JacocoHealthReportThresholds(30,90,25,80,15,60,15,60,20,70,0,0),getClass().getResourceAsStream("String_Node_Str"),getClass().getResourceAsStream("String_Node_Str"));
  assertEquals(65,r.clazz.getPercentage());
  assertEquals(37,r.line.getPercentage());
  assertCoverage(r.clazz,17 + 9,20 + 28);
  assertCoverage(r.method,167 + 122,69 + 116);
  assertCoverage(r.line,595 + 513,293 + 361);
  assertCoverage(r.branch,223 + 224,67 + 66);
  assertCoverage(r.instruction,2733 + 2548,1351 + 1613);
  assertCoverage(r.complexity,289 + 246,92 + 137);
  assertEquals("String_Node_Str",r.getBuildHealth().getDescription());
}

Fixed version (ground truth):
@Test public void testLoadMultipleReports() throws Exception {
  JacocoBuildAction r=JacocoBuildAction.load(null,null,new JacocoHealthReportThresholds(30,90,25,80,15,60,15,60,20,70,0,0),getClass().getResourceAsStream("String_Node_Str"),getClass().getResourceAsStream("String_Node_Str"));
  assertEquals(76,r.clazz.getPercentage());
  assertEquals(41,r.line.getPercentage());
  assertCoverage(r.clazz,9,28);
  assertCoverage(r.method,122,116);
  assertCoverage(r.line,513,361);
  assertCoverage(r.branch,224,66);
  assertCoverage(r.instruction,2548,1613);
  assertCoverage(r.complexity,246,137);
  assertEquals("String_Node_Str" + "String_Node_Str",r.getBuildHealth().getDescription());
}
Program: 48021
Project: 48021
Buggy source:
protected static FilePath[] getJacocoReports(File file) throws IOException, InterruptedException {
  FilePath path=new FilePath(file);
  if (path.isDirectory()) {
    return path.list("String_Node_Str");
  }
 else {
    FilePath report=new FilePath(new File(path.getName() + "String_Node_Str"));
    return report.exists() ? new FilePath[]{report} : new FilePath[0];
  }
}

Fixed version (ground truth):
protected static ArrayList<ModuleInfo> getJacocoReports(File file) throws IOException {
  FilePath path=new FilePath(file);
  ArrayList<ModuleInfo> reports=new ArrayList<ModuleInfo>();
  int i=0;
  try {
    FilePath checkPath=null;
    while (true) {
      if ((checkPath=new FilePath(path,"String_Node_Str" + i)).exists()) {
        ModuleInfo moduleInfo=new ModuleInfo();
        moduleInfo.setClassDir(new FilePath(checkPath,"String_Node_Str"));
        moduleInfo.setSrcDir(new FilePath(checkPath,"String_Node_Str"));
        moduleInfo.setExecFile(new FilePath(checkPath,"String_Node_Str"));
        moduleInfo.create();
        reports.add(moduleInfo);
      }
 else {
        break;
      }
      i++;
    }
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
  return reports;
}
Program: 48022
Project: 48022
Buggy source:
/** 
 * Obtains the detailed   {@link CoverageReport} instance.
 */
public synchronized CoverageReport getResult(){
  if (report != null) {
    final CoverageReport r=report.get();
    if (r != null)     return r;
  }
  final File reportFolder=JacocoPublisher.getJacocoReport(owner);
  try {
    CoverageReport r=new CoverageReport(this,reports);
    report=new WeakReference<CoverageReport>(r);
    return r;
  }
 catch (  IOException e) {
    logger.println("String_Node_Str" + reportFolder);
    e.printStackTrace(logger);
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Obtains the detailed   {@link CoverageReport} instance.
 */
public synchronized CoverageReport getResult(){
  if (report != null) {
    final CoverageReport r=report.get();
    if (r != null)     return r;
  }
  final File reportFolder=JacocoPublisher.getJacocoReport(owner);
  try {
    ArrayList<ModuleInfo> reports=getJacocoReports(reportFolder);
    CoverageReport r=new CoverageReport(this,reports);
    report=new WeakReference<CoverageReport>(r);
    return r;
  }
 catch (  IOException e) {
    logger.println("String_Node_Str" + reportFolder);
    e.printStackTrace(logger);
    return null;
  }
}
Program: 48024
Project: 48024
Buggy source:
protected void printRatioTable(Coverage ratio,StringBuilder buf){
  String percent=percentFormat.format(ratio.getPercentageFloat());
  String numerator=intFormat.format(ratio.getMissed());
  String denominator=intFormat.format(ratio.getCovered());
  int maximumCovered=1;
  if (ratio.getType().equals(CoverageElement.Type.INSTRUCTION)) {
    maximumCovered=maxInstruction;
  }
 else   if (ratio.getType().equals(CoverageElement.Type.BRANCH)) {
    maximumCovered=maxBranch;
  }
 else   if (ratio.getType().equals(CoverageElement.Type.COMPLEXITY)) {
    maximumCovered=maxComplexity;
  }
 else   if (ratio.getType().equals(CoverageElement.Type.LINE)) {
    maximumCovered=maxLine;
  }
 else   if (ratio.getType().equals(CoverageElement.Type.METHOD)) {
    maximumCovered=maxMethod;
  }
 else   if (ratio.getType().equals(CoverageElement.Type.CLASS)) {
    maximumCovered=maxClazz;
  }
  buf.append("String_Node_Str").append("String_Node_Str").append(percent).append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append(((float)ratio.getCovered() / (float)maximumCovered) * 100).append("String_Node_Str").append("String_Node_Str").append("String_Node_Str" + numerator).append("String_Node_Str").append("String_Node_Str" + denominator).append("String_Node_Str");
}

Fixed version (ground truth):
protected void printRatioTable(Coverage ratio,StringBuilder buf){
  String percent=percentFormat.format(ratio.getPercentageFloat());
  String numerator=intFormat.format(ratio.getMissed());
  String denominator=intFormat.format(ratio.getCovered());
  int maximumCovered=1;
  if (ratio.getType().equals(CoverageElement.Type.INSTRUCTION)) {
    maximumCovered=maxInstruction;
  }
 else   if (ratio.getType().equals(CoverageElement.Type.BRANCH)) {
    maximumCovered=maxBranch;
  }
 else   if (ratio.getType().equals(CoverageElement.Type.COMPLEXITY)) {
    maximumCovered=maxComplexity;
  }
 else   if (ratio.getType().equals(CoverageElement.Type.LINE)) {
    maximumCovered=maxLine;
  }
 else   if (ratio.getType().equals(CoverageElement.Type.METHOD)) {
    maximumCovered=maxMethod;
  }
 else   if (ratio.getType().equals(CoverageElement.Type.CLASS)) {
    maximumCovered=maxClazz;
  }
  buf.append("String_Node_Str").append("String_Node_Str").append(percent).append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append(((float)ratio.getCovered() / (float)maximumCovered) * 100).append("String_Node_Str").append("String_Node_Str").append(((float)ratio.getMissed() / (float)maximumCovered) * 100).append("String_Node_Str").append("String_Node_Str").append("String_Node_Str" + numerator).append("String_Node_Str").append("String_Node_Str" + denominator).append("String_Node_Str");
}
Program: 48025
Project: 48025
Buggy source:
protected JFreeChart createGraph(){
  final CategoryDataset dataset=createDataSet(obj).build();
  final JFreeChart chart=ChartFactory.createLineChart(null,null,"String_Node_Str",dataset,PlotOrientation.VERTICAL,true,true,false);
  final LegendTitle legend=chart.getLegend();
  legend.setPosition(RectangleEdge.RIGHT);
  chart.setBackgroundPaint(Color.white);
  final CategoryPlot plot=chart.getCategoryPlot();
  plot.setBackgroundPaint(Color.WHITE);
  plot.setOutlinePaint(null);
  plot.setRangeGridlinesVisible(true);
  plot.setRangeGridlinePaint(Color.black);
  CategoryAxis domainAxis=new ShiftedCategoryAxis(null);
  plot.setDomainAxis(domainAxis);
  domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
  domainAxis.setLowerMargin(0.0);
  domainAxis.setUpperMargin(0.0);
  domainAxis.setCategoryMargin(0.0);
  final NumberAxis rangeAxis=(NumberAxis)plot.getRangeAxis();
  rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
  rangeAxis.setUpperBound(100);
  rangeAxis.setLowerBound(0);
  final LineAndShapeRenderer renderer=(LineAndShapeRenderer)plot.getRenderer();
  renderer.setBaseStroke(new BasicStroke(4.0f));
  ColorPalette.apply(renderer);
  plot.setInsets(new RectangleInsets(5.0,0,0,5.0));
  return chart;
}

Fixed version (ground truth):
protected JFreeChart createGraph(){
  final CategoryDataset dataset=createDataSet(obj).build();
  final JFreeChart chart=ChartFactory.createLineChart(null,null,"String_Node_Str",dataset,PlotOrientation.VERTICAL,true,true,false);
  final LegendTitle legend=chart.getLegend();
  legend.setPosition(RectangleEdge.RIGHT);
  chart.setBackgroundPaint(Color.white);
  final CategoryPlot plot=chart.getCategoryPlot();
  plot.setBackgroundPaint(Color.WHITE);
  plot.setOutlinePaint(null);
  plot.setRangeGridlinesVisible(true);
  plot.setRangeGridlinePaint(Color.black);
  CategoryAxis domainAxis=new ShiftedCategoryAxis(null);
  plot.setDomainAxis(domainAxis);
  domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
  domainAxis.setLowerMargin(0.0);
  domainAxis.setUpperMargin(0.0);
  domainAxis.setCategoryMargin(0.0);
  final NumberAxis rangeAxis=(NumberAxis)plot.getRangeAxis();
  rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
  rangeAxis.setUpperBound(maxLine);
  rangeAxis.setLowerBound(0);
  final LineAndShapeRenderer renderer=(LineAndShapeRenderer)plot.getRenderer();
  renderer.setBaseStroke(new BasicStroke(4.0f));
  ColorPalette.apply(renderer);
  plot.setInsets(new RectangleInsets(5.0,0,0,5.0));
  return chart;
}
Program: 48026
Project: 48026
Buggy source:
/** 
 * Generates the graph that shows the coverage trend up to this report.
 */
public void doGraph(StaplerRequest req,StaplerResponse rsp) throws IOException {
  if (ChartUtil.awtProblemCause != null) {
    rsp.sendRedirect2(req.getContextPath() + "String_Node_Str");
    return;
  }
  AbstractBuild<?,?> build=getBuild();
  Calendar t=build.getTimestamp();
  String w=Util.fixEmptyAndTrim(req.getParameter("String_Node_Str"));
  String h=Util.fixEmptyAndTrim(req.getParameter("String_Node_Str"));
  int width=(w != null) ? Integer.valueOf(w) : 500;
  int height=(h != null) ? Integer.valueOf(h) : 200;
  new GraphImpl(this,t,width,height){
    @Override protected DataSetBuilder<String,NumberOnlyBuildLabel> createDataSet(    CoverageObject<SELF> obj){
      DataSetBuilder<String,NumberOnlyBuildLabel> dsb=new DataSetBuilder<String,NumberOnlyBuildLabel>();
      for (CoverageObject<SELF> a=obj; a != null; a=a.getPreviousResult()) {
        NumberOnlyBuildLabel label=new NumberOnlyBuildLabel(a.getBuild());
        if (a.line != null) {
          dsb.add(a.line.getCovered(),Messages.CoverageObject_Legend_Line(),label);
        }
      }
      return dsb;
    }
  }
.doPng(req,rsp);
}

Fixed version (ground truth):
/** 
 * Generates the graph that shows the coverage trend up to this report.
 */
public void doGraph(StaplerRequest req,StaplerResponse rsp) throws IOException {
  if (ChartUtil.awtProblemCause != null) {
    rsp.sendRedirect2(req.getContextPath() + "String_Node_Str");
    return;
  }
  AbstractBuild<?,?> build=getBuild();
  Calendar t=build.getTimestamp();
  String w=Util.fixEmptyAndTrim(req.getParameter("String_Node_Str"));
  String h=Util.fixEmptyAndTrim(req.getParameter("String_Node_Str"));
  int width=(w != null) ? Integer.valueOf(w) : 500;
  int height=(h != null) ? Integer.valueOf(h) : 200;
  new GraphImpl(this,t,width,height){
    @Override protected DataSetBuilder<String,NumberOnlyBuildLabel> createDataSet(    CoverageObject<SELF> obj){
      DataSetBuilder<String,NumberOnlyBuildLabel> dsb=new DataSetBuilder<String,NumberOnlyBuildLabel>();
      for (CoverageObject<SELF> a=obj; a != null; a=a.getPreviousResult()) {
        NumberOnlyBuildLabel label=new NumberOnlyBuildLabel(a.getBuild());
        if (a.line != null) {
          dsb.add(a.line.getCovered(),Messages.CoverageObject_Legend_Line(),label);
          dsb.add(a.line.getMissed(),Messages.CoverageObject_Legend_Line(),label);
        }
      }
      return dsb;
    }
  }
.doPng(req,rsp);
}
Program: 48027
Project: 48027
Buggy source:
private void loadExecutionData() throws IOException {
  final PrintStream logger=listener.getLogger();
  logger.println("String_Node_Str");
  File executionDataFile=new File(execFile.getRemote());
  logger.println("String_Node_Str" + executionDataFile.getAbsolutePath());
  logger.println("String_Node_Str" + title);
  final FileInputStream fis=new FileInputStream(executionDataFile);
  final ExecutionDataReader executionDataReader=new ExecutionDataReader(fis);
  executionDataStore=new ExecutionDataStore();
  sessionInfoStore=new SessionInfoStore();
  executionDataReader.setExecutionDataVisitor(executionDataStore);
  executionDataReader.setSessionInfoVisitor(sessionInfoStore);
  while (executionDataReader.read()) {
  }
  fis.close();
}

Fixed version (ground truth):
private void loadExecutionData() throws IOException {
  File executionDataFile=new File(execFile.getRemote());
  final FileInputStream fis=new FileInputStream(executionDataFile);
  final ExecutionDataReader executionDataReader=new ExecutionDataReader(fis);
  executionDataStore=new ExecutionDataStore();
  sessionInfoStore=new SessionInfoStore();
  executionDataReader.setExecutionDataVisitor(executionDataStore);
  executionDataReader.setSessionInfoVisitor(sessionInfoStore);
  while (executionDataReader.read()) {
  }
  fis.close();
}
Program: 48028
Project: 48028
Buggy source:
private IBundleCoverage analyzeStructure() throws IOException {
  final PrintStream logger=listener.getLogger();
  logger.println("String_Node_Str");
  File classDirectory=new File(classDir.getRemote());
  logger.println("String_Node_Str" + classDirectory.getAbsolutePath());
  final CoverageBuilder coverageBuilder=new CoverageBuilder();
  final Analyzer analyzer=new Analyzer(executionDataStore,coverageBuilder);
  analyzer.analyzeAll(classDirectory);
  return coverageBuilder.getBundle(title);
}

Fixed version (ground truth):
private IBundleCoverage analyzeStructure() throws IOException {
  File classDirectory=new File(classDir.getRemote());
  final CoverageBuilder coverageBuilder=new CoverageBuilder();
  final Analyzer analyzer=new Analyzer(executionDataStore,coverageBuilder);
  analyzer.analyzeAll(classDirectory);
  return coverageBuilder.getBundle(title);
}
Program: 48031
Project: 48031
Buggy source:
/** 
 * Gets the previous   {@link EmmaBuildAction} of the given build.
 */
static EmmaBuildAction getPreviousResult(Build start){
  Build b=start;
  while (true) {
    b=b.getPreviousBuild();
    if (b == null)     return null;
    if (b.getResult() == Result.FAILURE)     continue;
    EmmaBuildAction r=b.getAction(EmmaBuildAction.class);
    if (r != null)     return r;
  }
}

Fixed version (ground truth):
/** 
 * Gets the previous   {@link EmmaBuildAction} of the given build.
 */
static EmmaBuildAction getPreviousResult(Build start){
  Build<?,?> b=start;
  while (true) {
    b=b.getPreviousBuild();
    if (b == null)     return null;
    if (b.getResult() == Result.FAILURE)     continue;
    EmmaBuildAction r=b.getAction(EmmaBuildAction.class);
    if (r != null)     return r;
  }
}
Program: 48032
Project: 48032
Buggy source:
/** 
 * Gets the most recent   {@link EmmaBuildAction} object.
 */
public EmmaBuildAction getLastResult(){
  for (Build b=project.getLastBuild(); b != null; b=b.getPreviousBuild()) {
    if (b.getResult() == Result.FAILURE)     continue;
    EmmaBuildAction r=b.getAction(EmmaBuildAction.class);
    if (r != null)     return r;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Gets the most recent   {@link EmmaBuildAction} object.
 */
public EmmaBuildAction getLastResult(){
  for (Build<?,?> b=project.getLastBuild(); b != null; b=b.getPreviousBuild()) {
    if (b.getResult() == Result.FAILURE)     continue;
    EmmaBuildAction r=b.getAction(EmmaBuildAction.class);
    if (r != null)     return r;
  }
  return null;
}
Program: 48033
Project: 48033
Buggy source:
@Override public SELF getPreviousResult(){
  PARENT p=parent;
  while (true) {
    p=p.getPreviousResult();
    if (p == null)     return null;
    SELF prev=(SELF)parent.getChildren().get(name);
    if (prev != null)     return prev;
  }
}

Fixed version (ground truth):
@Override public SELF getPreviousResult(){
  PARENT p=parent;
  while (true) {
    p=p.getPreviousResult();
    if (p == null)     return null;
    SELF prev=(SELF)p.getChildren().get(name);
    if (prev != null)     return prev;
  }
}
Program: 48034
Project: 48034
Buggy source:
@Nullable public static long getLong(CkAttribute raw){
  int dataLen=raw.getLength().intValue();
  if (dataLen > 0) {
    if (dataLen == 4) {
      return raw.getData().getInt(0);
    }
 else {
      return raw.getData().getLong(0);
    }
  }
 else {
    return -1;
  }
}

Fixed version (ground truth):
@Nullable public static long getLong(CkAttribute raw){
  int dataLen=raw.getLength().intValue();
  if (dataLen > 0) {
    return getLongFromPointer(raw.getData(),0);
  }
 else {
    return -1;
  }
}
Program: 48035
Project: 48035
Buggy source:
@Nullable public static long[] getLongs(CkAttribute raw){
  int dataLen=raw.getLength().intValue();
  if (dataLen > 0) {
    return raw.getData().getLongArray(0,dataLen / 8);
  }
 else {
    return new long[0];
  }
}

Fixed version (ground truth):
@Nullable public static long[] getLongs(CkAttribute raw){
  int dataLen=raw.getLength().intValue();
  long[] result=new long[dataLen / NativeLong.SIZE];
  for (int i=0, o=0; o < dataLen; i++, o+=NativeLong.SIZE) {
    result[i]=getLongFromPointer(raw.getData(),o);
  }
  return result;
}
Program: 48036
Project: 48036
Buggy source:
@Override public void signalEvent(EventType eventType,EventObject eventData){
  LOG.debug("String_Node_Str",eventType);
  ConnectionHandleType ch=eventData.getHandle();
  if (ch == null) {
    LOG.error("String_Node_Str",eventType);
    return;
  }
  LOG.debug("String_Node_Str",ch);
  RecognitionInfo info=ch.getRecognitionInfo();
  LOG.debug("String_Node_Str",info);
  String ifdName=ch.getIFDName();
  LOG.debug("String_Node_Str",ifdName);
  if (null != eventType) {
switch (eventType) {
case TERMINAL_ADDED:
      addInfo(ifdName,info);
    break;
case TERMINAL_REMOVED:
  removeInfo(ifdName);
break;
default :
EventType lastStatus=cardStatus.get(ifdName);
if (EventType.CARD_RECOGNIZED == lastStatus) {
if (EventType.CARD_REMOVED == eventType) {
cardStatus.remove(ifdName);
updateInfo(ifdName,info);
}
}
 else {
if (EventType.CARD_REMOVED == eventType) {
cardStatus.remove(ifdName);
}
 else {
cardStatus.put(ifdName,eventType);
}
updateInfo(ifdName,info);
}
}
}
}

Fixed version (ground truth):
@Override public synchronized void signalEvent(EventType eventType,EventObject eventData){
  LOG.debug("String_Node_Str",eventType);
  ConnectionHandleType ch=eventData.getHandle();
  if (ch == null) {
    LOG.error("String_Node_Str",eventType);
    return;
  }
  LOG.debug("String_Node_Str",ch);
  RecognitionInfo info=ch.getRecognitionInfo();
  LOG.debug("String_Node_Str",info);
  String ifdName=ch.getIFDName();
  LOG.debug("String_Node_Str",ifdName);
  if (null != eventType) {
switch (eventType) {
case TERMINAL_ADDED:
      addInfo(ifdName,info);
    break;
case TERMINAL_REMOVED:
  removeInfo(ifdName);
break;
default :
EventType lastStatus=cardStatus.get(ifdName);
if (EventType.CARD_RECOGNIZED == lastStatus) {
if (EventType.CARD_REMOVED == eventType) {
cardStatus.remove(ifdName);
updateInfo(ifdName,info);
}
}
 else {
if (EventType.CARD_REMOVED == eventType) {
cardStatus.remove(ifdName);
}
 else {
cardStatus.put(ifdName,eventType);
}
updateInfo(ifdName,info);
}
}
}
}
Program: 48038
Project: 48038
Buggy source:
public synchronized static ServiceContext getServiceContext(){
  return ctx;
}

Fixed version (ground truth):
public static ServiceContext getServiceContext(){
synchronized (ServiceContext.class) {
    if (ctx == null) {
      ctx=new ServiceContext();
    }
  }
  return ctx;
}
Program: 48039
Project: 48039
Buggy source:
@Override public void setResultOfBindingTask(BindingTaskResponse response){
  redirectToResultLocation(response.getBindingResult());
}

Fixed version (ground truth):
@Override public void setResultOfBindingTask(BindingTaskResponse response){
  BindingResult result=response.getBindingResult();
switch (result.getResultCode()) {
case OK:
    authenticationSuccess(result);
  break;
case REDIRECT:
authenticationSuccess(result);
redirectToResultLocation(result);
break;
default :
authenticationFailure(response.getBindingResult());
break;
}
}
Program: 48040
Project: 48040
Buggy source:
private ServiceContext getServiceContext() throws UnableToInitialize, NfcUnavailable, NfcDisabled, ApduExtLengthNotSupported {
  ServiceContext ctx=null;
  if (isRequiredAPIUsed) {
    ctx=(ServiceContext)((ContextWrapper)calling).getApplicationContext();
    if (!ctx.isInitialized()) {
      ctx.initialize();
    }
  }
 else {
    LOG.warn(BELOW_API_LEVEL_21_NOT_SUPPORTED);
  }
  return ctx;
}

Fixed version (ground truth):
private ServiceContext getServiceContext() throws UnableToInitialize, NfcUnavailable, NfcDisabled, ApduExtLengthNotSupported {
  ServiceContext ctx=null;
  if (isRequiredAPIUsed) {
    ctx=ServiceContext.getServiceContext();
    if (!ctx.isInitialized()) {
      ctx.initialize();
    }
  }
 else {
    LOG.warn(BELOW_API_LEVEL_21_NOT_SUPPORTED);
  }
  return ctx;
}
Program: 48041
Project: 48041
Buggy source:
public synchronized void startService(){
  if (isServiceBinded && !isConnected) {
    startOpeneCardService();
  }
 else   if (!isServiceBinded) {
    Intent i=createOpeneCardIntent();
    LOG.info("String_Node_Str");
    ctx.startService(i);
    LOG.info("String_Node_Str");
    ctx.bindService(i,serviceConnection,ServiceContext.BIND_AUTO_CREATE);
  }
}

Fixed version (ground truth):
public synchronized void startService(){
  if (isServiceBinded && !isConnected) {
    startOpeneCardService();
  }
 else   if (!isServiceBinded) {
    Intent i=createOpeneCardIntent();
    LOG.info("String_Node_Str");
    ctx.startService(i);
    LOG.info("String_Node_Str");
    ctx.bindService(i,serviceConnection,Context.BIND_AUTO_CREATE);
  }
}
Program: 48042
Project: 48042
Buggy source:
private void startOpeneCardService(){
  try {
    ServiceResponse response=mService.start();
    isConnected=false;
switch (response.getResponseLevel()) {
case INFO:
      isConnected=true;
    responseHandler.onConnectionSuccess();
  break;
case WARNING:
responseHandler.onConnectionFailure((ServiceWarningResponse)response);
break;
case ERROR:
responseHandler.onConnectionFailure((ServiceErrorResponse)response);
break;
default :
break;
}
}
 catch (RemoteException ex) {
responseHandler.onConnectionFailure(buildErrorResponse(ex));
}
}

Fixed version (ground truth):
private void startOpeneCardService(){
  ServiceContext.getServiceContext().setApplicationContext(ctx);
  try {
    ServiceResponse response=mService.start();
    isConnected=false;
switch (response.getResponseLevel()) {
case INFO:
      isConnected=true;
    responseHandler.onConnectionSuccess();
  break;
case WARNING:
responseHandler.onConnectionFailure((ServiceWarningResponse)response);
break;
case ERROR:
responseHandler.onConnectionFailure((ServiceErrorResponse)response);
break;
default :
break;
}
}
 catch (RemoteException ex) {
responseHandler.onConnectionFailure(buildErrorResponse(ex));
}
}