nus-yam/ex-repair huggingface dataset:
Program: 31029
Project: 31029
Buggy source:
@FXML public void saveClicked(ActionEvent event){
  final LHProtos.ProjectDetails detailsProto=model.getDetailsProto().build();
  log.info("String_Node_Str",detailsProto.getExtraDetails().getTitle());
  try {
    Project project;
    if (!detailsProto.hasPaymentUrl()) {
      DirectoryChooser chooser=new DirectoryChooser();
      chooser.setTitle("String_Node_Str");
      platformFiddleChooser(chooser);
      File dir=chooser.showDialog(Main.instance.mainStage);
      if (dir == null)       return;
      final Path dirPath=dir.toPath();
      project=model.getProject();
      final Project fp=project;
      overlayUI.runAfterFade(ev -> {
        saveAndWatchDirectory(fp,dirPath);
      }
);
      overlayUI.done();
    }
 else {
      project=Main.backend.saveProject(model.getProject());
      ExportWindow.openForProject(project);
    }
    Main.wallet.setTag("String_Node_Str" + project.getID(),ByteString.EMPTY);
  }
 catch (  IOException e) {
    informationalAlert("String_Node_Str","String_Node_Str",Throwables.getRootCause(e).getMessage());
  }
}

Fixed version (ground truth):
@FXML public void saveClicked(ActionEvent event){
  Platform.runLater(() -> {
    final LHProtos.ProjectDetails detailsProto=model.getDetailsProto().build();
    log.info("String_Node_Str",detailsProto.getExtraDetails().getTitle());
    try {
      Project project;
      if (!detailsProto.hasPaymentUrl()) {
        DirectoryChooser chooser=new DirectoryChooser();
        chooser.setTitle("String_Node_Str");
        platformFiddleChooser(chooser);
        File dir=chooser.showDialog(Main.instance.mainStage);
        if (dir == null)         return;
        final Path dirPath=dir.toPath();
        project=model.getProject();
        final Project fp=project;
        overlayUI.runAfterFade(ev -> {
          saveAndWatchDirectory(fp,dirPath);
        }
);
        overlayUI.done();
      }
 else {
        project=Main.backend.saveProject(model.getProject());
        ExportWindow.openForProject(project);
      }
      Main.wallet.setTag("String_Node_Str" + project.getID(),ByteString.EMPTY);
    }
 catch (    IOException e) {
      informationalAlert("String_Node_Str","String_Node_Str",Throwables.getRootCause(e).getMessage());
    }
  }
);
}
Program: 31030
Project: 31030
Buggy source:
@FXML public void confirmClicked(){
  log.info("String_Node_Str",amountEdit.getText());
  Platform.runLater(() -> {
    if (Main.wallet.isEncrypted()) {
      log.info("String_Node_Str");
      Main.OverlayUI<WalletPasswordController> pwd=Main.instance.overlayUI("String_Node_Str","String_Node_Str");
      pwd.controller.aesKeyProperty().addListener((observable,old,cur) -> {
        checkGuiThread();
        tryMakePledge(cur);
      }
);
    }
 else {
      tryMakePledge(null);
    }
  }
);
}

Fixed version (ground truth):
@FXML public void confirmClicked(){
  log.info("String_Node_Str",amountEdit.getText());
  Platform.runLater(() -> {
    if (Main.wallet.isEncrypted()) {
      log.info("String_Node_Str");
      WalletPasswordController.requestPassword(this::tryMakePledge);
    }
 else {
      tryMakePledge(null);
    }
  }
);
}
Program: 31031
Project: 31031
Buggy source:
private void confirmClicked(){
  if (Main.wallet.isEncrypted()) {
    log.info("String_Node_Str");
    Main.OverlayUI<WalletPasswordController> pwd=Main.instance.overlayUI("String_Node_Str","String_Node_Str");
    pwd.controller.aesKeyProperty().addListener((observable,old,cur) -> {
      checkGuiThread();
      Main.OverlayUI<RevokeAndClaimWindow> screen=Main.instance.overlayUI("String_Node_Str","String_Node_Str");
      screen.controller.pledgeToRevoke=pledgeToRevoke;
      screen.controller.projectToClaim=projectToClaim;
      screen.controller.pledgesToClaim=pledgesToClaim;
      screen.controller.onSuccess=onSuccess;
      screen.controller.go(cur);
    }
);
  }
 else {
    go(null);
  }
}

Fixed version (ground truth):
private void confirmClicked(){
  if (Main.wallet.isEncrypted()) {
    log.info("String_Node_Str");
    WalletPasswordController.requestPassword(key -> {
      Main.OverlayUI<RevokeAndClaimWindow> screen=Main.instance.overlayUI("String_Node_Str","String_Node_Str");
      screen.controller.pledgeToRevoke=pledgeToRevoke;
      screen.controller.projectToClaim=projectToClaim;
      screen.controller.pledgesToClaim=pledgesToClaim;
      screen.controller.onSuccess=onSuccess;
      screen.controller.go(key);
    }
);
  }
 else {
    go(null);
  }
}
Program: 31032
Project: 31032
Buggy source:
private void askForPasswordAndRetry(){
  Main.OverlayUI<WalletPasswordController> pwd=Main.instance.overlayUI("String_Node_Str");
  final String addressStr=address.getText();
  pwd.controller.aesKeyProperty().addListener((observable,old,cur) -> {
    checkGuiThread();
    Main.OverlayUI<SendMoneyController> screen=Main.instance.overlayUI("String_Node_Str");
    screen.controller.aesKey=cur;
    screen.controller.address.setText(addressStr);
    screen.controller.send(null);
  }
);
}

Fixed version (ground truth):
private void askForPasswordAndRetry(){
  final String addressStr=address.getText();
  WalletPasswordController.requestPassword(key -> {
    Main.OverlayUI<SendMoneyController> screen=open();
    screen.controller.aesKey=key;
    screen.controller.address.setText(addressStr);
    screen.controller.send(null);
  }
);
}
Program: 31033
Project: 31033
Buggy source:
private void askForPasswordAndRetry(){
  Main.OverlayUI<WalletPasswordController> pwd=Main.instance.overlayUI("String_Node_Str","String_Node_Str");
  pwd.controller.aesKeyProperty().addListener((observable,old,cur) -> {
    checkGuiThread();
    Main.OverlayUI<WalletSettingsController> screen=Main.instance.overlayUI("String_Node_Str","String_Node_Str");
    screen.controller.initialize(cur);
  }
);
}

Fixed version (ground truth):
private void askForPasswordAndRetry(){
  WalletPasswordController.requestPassword(key -> {
    checkGuiThread();
    Main.OverlayUI<WalletSettingsController> screen=Main.instance.overlayUI("String_Node_Str","String_Node_Str");
    screen.controller.initialize(key);
  }
);
}
Program: 31035
Project: 31035
Buggy source:
@Test public void serverAndLocalAreDeduped() throws Exception {
  projectModel.serverName.set("String_Node_Str");
  project=projectModel.getProject();
  final LHProtos.Pledge pledge=LHProtos.Pledge.newBuilder().setTotalInputValue(Coin.COIN.value).setProjectId(project.getID()).setTimestamp(Utils.currentTimeSeconds()).addTransactions(ByteString.copyFromUtf8("String_Node_Str")).build();
  final Sha256Hash origHash=Sha256Hash.create(pledge.toByteArray());
  final LHProtos.Pledge scrubbedPledge=pledge.toBuilder().clearTransactions().setOrigHash(ByteString.copyFrom(origHash.getBytes())).build();
  Path projectPath=writeProjectToDisk();
  injectedPledge=pledge;
  executor.service.shutdown();
  executor.service.awaitTermination(5,TimeUnit.SECONDS);
  executor=new AffinityExecutor.ServiceAffinityExecutor("String_Node_Str");
  diskManager=new DiskManager(executor,true);
  diskManager.addProjectFile(projectPath);
  backend=new LighthouseBackend(CLIENT,peerGroup,blockChain,pledgingWallet,diskManager,executor);
  ObservableSet<LHProtos.Pledge> pledges=backend.mirrorOpenPledges(project,gate);
  assertEquals(1,pledges.size());
  assertEquals(pledge,pledges.iterator().next());
  gate.waitAndRun();
  sendServerStatus(scrubbedPledge,httpReqs.take());
  CompletableFuture future=backend.refreshProjectStatusFromServer(project);
  gate.waitAndRun();
  sendServerStatus(scrubbedPledge,httpReqs.take());
  future.get();
  assertEquals(0,gate.getTaskQueueSize());
  assertEquals(1,pledges.size());
  assertEquals(pledge,pledges.iterator().next());
}

Fixed version (ground truth):
@Test public void serverAndLocalAreDeduped() throws Exception {
  projectModel.serverName.set("String_Node_Str");
  project=projectModel.getProject();
  final LHProtos.Pledge pledge=LHProtos.Pledge.newBuilder().setTotalInputValue(Coin.COIN.value).setProjectId(project.getID()).setTimestamp(Utils.currentTimeSeconds()).addTransactions(ByteString.copyFromUtf8("String_Node_Str")).build();
  final Sha256Hash origHash=Sha256Hash.create(pledge.toByteArray());
  final LHProtos.Pledge scrubbedPledge=pledge.toBuilder().clearTransactions().setOrigHash(ByteString.copyFrom(origHash.getBytes())).build();
  Path projectPath=writeProjectToDisk();
  injectedPledge=pledge;
  executor.service.shutdown();
  executor.service.awaitTermination(5,TimeUnit.SECONDS);
  executor=new AffinityExecutor.ServiceAffinityExecutor("String_Node_Str");
  diskManager=new DiskManager(executor,true);
  diskManager.addProjectFile(projectPath);
  backend=new LighthouseBackend(CLIENT,peerGroup,blockChain,pledgingWallet,diskManager,executor);
  ObservableSet<LHProtos.Pledge> pledges=backend.mirrorOpenPledges(project,gate);
  assertEquals(1,pledges.size());
  assertEquals(pledge,pledges.iterator().next());
  gate.waitAndRun();
  sendServerStatus(httpReqs.take(),scrubbedPledge);
  CompletableFuture future=backend.refreshProjectStatusFromServer(project);
  gate.waitAndRun();
  sendServerStatus(httpReqs.take(),scrubbedPledge);
  future.get();
  assertEquals(0,gate.getTaskQueueSize());
  assertEquals(1,pledges.size());
  assertEquals(pledge,pledges.iterator().next());
}
Program: 31036
Project: 31036
Buggy source:
private void sendServerStatus(LHProtos.Pledge scrubbedPledge,HttpExchange exchange) throws IOException {
  LHProtos.ProjectStatus.Builder status=LHProtos.ProjectStatus.newBuilder();
  status.setId(project.getID());
  status.setTimestamp(Instant.now().getEpochSecond());
  status.setValuePledgedSoFar(Coin.COIN.value);
  status.addPledges(scrubbedPledge);
  byte[] bits=status.build().toByteArray();
  exchange.sendResponseHeaders(HTTP_OK,bits.length);
  exchange.getResponseBody().write(bits);
  exchange.close();
}

Fixed version (ground truth):
private void sendServerStatus(HttpExchange exchange,LHProtos.Pledge... scrubbedPledges) throws IOException {
  LHProtos.ProjectStatus.Builder status=LHProtos.ProjectStatus.newBuilder();
  status.setId(project.getID());
  status.setTimestamp(Instant.now().getEpochSecond());
  status.setValuePledgedSoFar(Coin.COIN.value);
  for (  LHProtos.Pledge pledge : scrubbedPledges) {
    status.addPledges(pledge);
  }
  byte[] bits=status.build().toByteArray();
  exchange.sendResponseHeaders(HTTP_OK,bits.length);
  exchange.getResponseBody().write(bits);
  exchange.close();
}
Program: 31037
Project: 31037
Buggy source:
@Test public void projectAddedWithServer() throws Exception {
  projectModel.serverName.set("String_Node_Str");
  project=projectModel.getProject();
  final LHProtos.Pledge scrubbedPledge=makeScrubbedPledge();
  Path projectPath=writeProjectToDisk();
  ObservableList<Project> projects=backend.mirrorProjects(gate);
  assertEquals(0,projects.size());
  backend.addProjectFile(projectPath);
  assertEquals(0,projects.size());
  gate.waitAndRun();
  assertEquals(1,projects.size());
  final Project project1=projects.iterator().next();
  assertEquals("String_Node_Str",project1.getTitle());
  ObservableSet<LHProtos.Pledge> pledges=backend.mirrorOpenPledges(project1,gate);
  gate.waitAndRun();
  HttpExchange exchange=httpReqs.take();
  sendServerStatus(scrubbedPledge,exchange);
  pledges.addListener((SetChangeListener<LHProtos.Pledge>)c -> {
    assertTrue(c.wasAdded());
  }
);
  gate.waitAndRun();
  assertEquals(1,pledges.size());
  assertEquals(Coin.COIN.value,pledges.iterator().next().getTotalInputValue());
}

Fixed version (ground truth):
@Test public void projectAddedWithServer() throws Exception {
  projectModel.serverName.set("String_Node_Str");
  project=projectModel.getProject();
  final LHProtos.Pledge scrubbedPledge=makeScrubbedPledge();
  Path projectPath=writeProjectToDisk();
  ObservableList<Project> projects=backend.mirrorProjects(gate);
  assertEquals(0,projects.size());
  backend.addProjectFile(projectPath);
  assertEquals(0,projects.size());
  gate.waitAndRun();
  assertEquals(1,projects.size());
  final Project project1=projects.iterator().next();
  assertEquals("String_Node_Str",project1.getTitle());
  ObservableSet<LHProtos.Pledge> pledges=backend.mirrorOpenPledges(project1,gate);
  gate.waitAndRun();
  HttpExchange exchange=httpReqs.take();
  sendServerStatus(exchange,scrubbedPledge);
  pledges.addListener((SetChangeListener<LHProtos.Pledge>)c -> {
    assertTrue(c.wasAdded());
  }
);
  gate.waitAndRun();
  assertEquals(1,pledges.size());
  assertEquals(Coin.COIN.value,pledges.iterator().next().getTotalInputValue());
}
Program: 31038
Project: 31038
Buggy source:
@Test public void serverCheckStatus() throws Exception {
  projectModel.serverName.set("String_Node_Str");
  project=projectModel.getProject();
  final LHProtos.Pledge scrubbedPledge=makeScrubbedPledge();
  ObservableMap<Project,LighthouseBackend.CheckStatus> statuses=backend.mirrorCheckStatuses(gate);
  assertEquals(0,statuses.size());
  Path projectPath=writeProjectToDisk();
  backend.addProjectFile(projectPath);
  gate.waitAndRun();
  assertEquals(1,statuses.size());
  assertNotNull(statuses.get(project));
  assertTrue(statuses.get(project).inProgress);
  assertNull(statuses.get(project).error);
  gate.waitAndRun();
  HttpExchange exchange=httpReqs.take();
  exchange.sendResponseHeaders(404,-1);
  gate.waitAndRun();
  assertEquals(1,statuses.size());
  assertFalse(statuses.get(project).inProgress);
  final Throwable error=statuses.get(project).error;
  assertNotNull(error);
  assertEquals(java.io.FileNotFoundException.class,error.getClass());
  backend.refreshProjectStatusFromServer(project);
  gate.waitAndRun();
  assertEquals(1,statuses.size());
  assertTrue(statuses.get(project).inProgress);
  gate.waitAndRun();
  exchange=httpReqs.take();
  sendServerStatus(scrubbedPledge,exchange);
  gate.waitAndRun();
  assertEquals(0,statuses.size());
}

Fixed version (ground truth):
@Test public void serverCheckStatus() throws Exception {
  projectModel.serverName.set("String_Node_Str");
  project=projectModel.getProject();
  final LHProtos.Pledge scrubbedPledge=makeScrubbedPledge();
  ObservableMap<Project,LighthouseBackend.CheckStatus> statuses=backend.mirrorCheckStatuses(gate);
  assertEquals(0,statuses.size());
  Path projectPath=writeProjectToDisk();
  backend.addProjectFile(projectPath);
  gate.waitAndRun();
  assertEquals(1,statuses.size());
  assertNotNull(statuses.get(project));
  assertTrue(statuses.get(project).inProgress);
  assertNull(statuses.get(project).error);
  gate.waitAndRun();
  HttpExchange exchange=httpReqs.take();
  exchange.sendResponseHeaders(404,-1);
  gate.waitAndRun();
  assertEquals(1,statuses.size());
  assertFalse(statuses.get(project).inProgress);
  final Throwable error=statuses.get(project).error;
  assertNotNull(error);
  assertEquals(java.io.FileNotFoundException.class,error.getClass());
  backend.refreshProjectStatusFromServer(project);
  gate.waitAndRun();
  assertEquals(1,statuses.size());
  assertTrue(statuses.get(project).inProgress);
  gate.waitAndRun();
  exchange=httpReqs.take();
  sendServerStatus(exchange,scrubbedPledge);
  gate.waitAndRun();
  assertEquals(0,statuses.size());
}
Program: 31039
Project: 31039
Buggy source:
private CompletableFuture<Void> lookupPledgesFromServer(Project project){
  CompletableFuture<Void> future=new CompletableFuture<>();
  executor.execute(() -> {
    markAsInProgress(project);
    project.getStatus(wallet,null).whenCompleteAsync((status,ex) -> {
      if (ex != null) {
        markAsErrored(project,ex);
        future.completeExceptionally(ex);
      }
 else {
        log.info("String_Node_Str",status);
        syncPledges(project,new HashSet<>(status.getPledgesList()),status.getPledgesList(),true);
        if (status.hasClaimedBy() && diskManager.getProjectState(project).state != ProjectState.CLAIMED) {
          diskManager.setProjectState(project,new ProjectStateInfo(ProjectState.CLAIMED,new Sha256Hash(status.getClaimedBy().toByteArray())));
        }
        markAsCheckDone(project);
        future.complete(null);
      }
    }
,executor);
  }
);
  return future;
}

Fixed version (ground truth):
private CompletableFuture<Void> lookupPledgesFromServer(Project project){
  CompletableFuture<Void> future=new CompletableFuture<>();
  executor.execute(() -> {
    markAsInProgress(project);
    project.getStatus(wallet,null).whenCompleteAsync((status,ex) -> {
      if (ex != null) {
        markAsErrored(project,ex);
        future.completeExceptionally(ex);
      }
 else {
        log.info("String_Node_Str",status);
        syncPledges(project,new HashSet<>(status.getPledgesList()),status.getPledgesList());
        if (status.hasClaimedBy() && diskManager.getProjectState(project).state != ProjectState.CLAIMED) {
          diskManager.setProjectState(project,new ProjectStateInfo(ProjectState.CLAIMED,new Sha256Hash(status.getClaimedBy().toByteArray())));
        }
        markAsCheckDone(project);
        future.complete(null);
      }
    }
,executor);
  }
);
  return future;
}
Program: 31041
Project: 31041
Buggy source:
private void syncPledges(Project forProject,Set<LHProtos.Pledge> testedPledges,List<LHProtos.Pledge> verifiedPledges,boolean moveMissing){
  executor.checkOnThread();
  final ObservableSet<LHProtos.Pledge> curOpenPledges=getOpenPledgesFor(forProject);
  Map<Sha256Hash,LHProtos.Pledge> hashes=curOpenPledges.stream().collect(toMap(p -> Sha256Hash.create(p.toByteArray()),p -> p));
  Set<LHProtos.Pledge> newlyOpen=new HashSet<>(verifiedPledges);
  newlyOpen.removeAll(curOpenPledges);
  if (mode == Mode.CLIENT) {
    newlyOpen.removeIf(wallet::wasPledgeRevoked);
    newlyOpen.removeIf(pledge -> pledge.hasOrigHash() && hashes.get(hashFromPledge(pledge)) != null);
  }
  curOpenPledges.addAll(newlyOpen);
  Set<LHProtos.Pledge> newlyInvalid=new HashSet<>(testedPledges);
  newlyInvalid.removeAll(verifiedPledges);
  curOpenPledges.removeAll(newlyInvalid);
  if (forProject.getPaymentURL() == null || mode == Mode.SERVER) {
    Transaction claim=getClaimForProject(forProject);
    if (claim != null) {
      Set<LHProtos.Pledge> newlyClaimed=new HashSet<>(newlyInvalid);
      newlyClaimed.removeIf(pledge -> !LHUtils.pledgeAppearsInClaim(forProject,pledge,claim));
      ObservableSet<LHProtos.Pledge> cpf=getClaimedPledgesFor(forProject);
      cpf.addAll(newlyClaimed);
    }
  }
}

Fixed version (ground truth):
private void syncPledges(Project forProject,Set<LHProtos.Pledge> testedPledges,List<LHProtos.Pledge> verifiedPledges){
  executor.checkOnThread();
  final ObservableSet<LHProtos.Pledge> curOpenPledges=getOpenPledgesFor(forProject);
  Map<Sha256Hash,LHProtos.Pledge> hashes=curOpenPledges.stream().collect(toMap(p -> Sha256Hash.create(p.toByteArray()),p -> p));
  Set<LHProtos.Pledge> newlyOpen=new HashSet<>(verifiedPledges);
  newlyOpen.removeAll(curOpenPledges);
  if (mode == Mode.CLIENT) {
    newlyOpen.removeIf(wallet::wasPledgeRevoked);
    newlyOpen.removeIf(pledge -> pledge.hasOrigHash() && hashes.get(hashFromPledge(pledge)) != null);
  }
  curOpenPledges.addAll(newlyOpen);
  Set<LHProtos.Pledge> newlyInvalid=new HashSet<>(testedPledges);
  newlyInvalid.removeAll(verifiedPledges);
  curOpenPledges.removeAll(newlyInvalid);
  if (forProject.getPaymentURL() != null && mode == Mode.CLIENT) {
    Set<LHProtos.Pledge> removedItems=new HashSet<>(hashes.values());
    for (    LHProtos.Pledge pledge : verifiedPledges) {
      LHProtos.Pledge orig=hashes.get(hashFromPledge(pledge));
      if (orig != null)       removedItems.remove(orig);
    }
    if (removedItems.size() > 0) {
      log.info("String_Node_Str",removedItems);
      curOpenPledges.removeAll(removedItems);
    }
  }
  if (forProject.getPaymentURL() == null || mode == Mode.SERVER) {
    Transaction claim=getClaimForProject(forProject);
    if (claim != null) {
      Set<LHProtos.Pledge> newlyClaimed=new HashSet<>(newlyInvalid);
      newlyClaimed.removeIf(pledge -> !LHUtils.pledgeAppearsInClaim(forProject,pledge,claim));
      ObservableSet<LHProtos.Pledge> cpf=getClaimedPledgesFor(forProject);
      cpf.addAll(newlyClaimed);
    }
  }
}
Program: 31042
Project: 31042
Buggy source:
private void revokePledge(Project project){
  log.info("String_Node_Str",project.getTitle());
  LHProtos.Pledge pledge=Main.wallet.getPledgeFor(project);
  checkNotNull(pledge,"String_Node_Str");
  Main.OverlayUI<PledgeRevokeWindow> overlay=Main.instance.overlayUI("String_Node_Str","String_Node_Str");
  overlay.controller.onSuccess=() -> {
    mode=Mode.OPEN_FOR_PLEDGES;
    updateGUIForState();
  }
;
  overlay.controller.pledgeToRevoke=pledge;
}

Fixed version (ground truth):
private void revokePledge(Project project){
  log.info("String_Node_Str",project.getTitle());
  LHProtos.Pledge pledge=Main.wallet.getPledgeFor(project);
  checkNotNull(pledge,"String_Node_Str");
  Main.OverlayUI<RevokeAndClaimWindow> overlay=RevokeAndClaimWindow.openForRevoke(pledge);
  overlay.controller.onSuccess=() -> {
    mode=Mode.OPEN_FOR_PLEDGES;
    updateGUIForState();
  }
;
}
Program: 31043
Project: 31043
Buggy source:
private void claimPledges(Project p){
  log.info("String_Node_Str",p);
  try {
    CompletableFuture<Transaction> tx=Main.wallet.completeContractWithFee(p,pledges);
    tx.handle((t,ex) -> {
      if (ex != null) {
        GuiUtils.crashAlert(ex);
      }
 else {
        informationalAlert("String_Node_Str","String_Node_Str" + "String_Node_Str");
      }
      return null;
    }
);
  }
 catch (  Ex.ValueMismatch e) {
    informationalAlert("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",Coin.valueOf(e.byAmount).toFriendlyString());
  }
catch (  InsufficientMoneyException e) {
    informationalAlert("String_Node_Str","String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
private void claimPledges(Project p){
  log.info("String_Node_Str",p);
  Main.OverlayUI<RevokeAndClaimWindow> overlay=RevokeAndClaimWindow.openForClaim(p,pledges);
  overlay.controller.onSuccess=() -> {
    mode=Mode.OPEN_FOR_PLEDGES;
    updateGUIForState();
  }
;
}
Program: 31044
Project: 31044
Buggy source:
protected void markDiffPoints(Screenshot expected,Screenshot actual,ImageDiff diff){
  Coords expectedImageCoords=Coords.ofImage(expected.getImage());
  Coords actualImageCoords=Coords.ofImage(actual.getImage());
  CoordsSet compareCoordsSet=new CoordsSet(CoordsSet.union(actual.getCoordsToCompare(),expected.getCoordsToCompare()));
  CoordsSet ignoreCoordsSet=new CoordsSet(CoordsSet.intersection(actual.getIgnoredAreas(),expected.getIgnoredAreas()));
  int width=Math.max(expected.getImage().getWidth(),actual.getImage().getWidth());
  int height=Math.max(expected.getImage().getHeight(),actual.getImage().getHeight());
  diff.setDiffImage(createDiffImage(expected.getImage(),actual.getImage(),width,height));
  for (int i=0; i < width; i++) {
    for (int j=0; j < height; j++) {
      if (insideBothImages(i,j,expectedImageCoords,actualImageCoords) && !ignoreCoordsSet.contains(i,j) && compareCoordsSet.contains(i,j)&& hasDiffInChannel(expected,actual,i,j)) {
        diff.addDiffPoint(i,j);
      }
    }
  }
}

Fixed version (ground truth):
protected void markDiffPoints(Screenshot expected,Screenshot actual,ImageDiff diff){
  Coords expectedImageCoords=Coords.ofImage(expected.getImage());
  Coords actualImageCoords=Coords.ofImage(actual.getImage());
  CoordsSet compareCoordsSet=new CoordsSet(CoordsSet.union(actual.getCoordsToCompare(),expected.getCoordsToCompare()));
  CoordsSet ignoreCoordsSet=new CoordsSet(CoordsSet.intersection(actual.getIgnoredAreas(),expected.getIgnoredAreas()));
  int width=Math.max(expected.getImage().getWidth(),actual.getImage().getWidth());
  int height=Math.max(expected.getImage().getHeight(),actual.getImage().getHeight());
  diff.setDiffImage(createDiffImage(expected.getImage(),actual.getImage(),width,height));
  for (int i=0; i < width; i++) {
    for (int j=0; j < height; j++) {
      if (insideBothImages(i,j,expectedImageCoords,actualImageCoords) && !ignoreCoordsSet.contains(i,j) && compareCoordsSet.contains(i,j)&& hasDiffInChannel(expected,actual,i,j) || !insideBothImages(i,j,expectedImageCoords,actualImageCoords)) {
        diff.addDiffPoint(i,j);
      }
    }
  }
}
Program: 31045
Project: 31045
Buggy source:
public static CoordsPreparationStrategy intersectingWith(final Screenshot screenshot){
  return new CoordsPreparationStrategy(){
    @Override public Set<Coords> prepare(    Collection<Coords> coordinates){
      return setReferenceCoords(screenshot.getOriginShift(),intersection(screenshot.getCoordsToCompare(),coordinates));
    }
  }
;
}

Fixed version (ground truth):
public static CoordsPreparationStrategy intersectingWith(final Screenshot screenshot){
  return new CoordsPreparationStrategy(){
    @Override public Set<Coords> prepare(    Collection<Coords> coordinates){
      return intersection(screenshot.getCoordsToCompare(),setReferenceCoords(screenshot.getOriginShift(),new HashSet<>(coordinates)));
    }
  }
;
}
Program: 31046
Project: 31046
Buggy source:
private void setSharedPoint(int i,int j,Screenshot expected,Screenshot actual,ImageDiff diff){
  if (Coords.ofImage(expected.getImage()).contains(i,j)) {
    diff.getDiffImage().setRGB(i,j,expected.getImage().getRGB(i,j));
  }
 else {
    diff.getDiffImage().setRGB(i,j,actual.getImage().getRGB(i,j));
  }
}

Fixed version (ground truth):
private void setSharedPoint(int i,int j,Screenshot expected,Screenshot actual,ImageDiff diff){
  if (Coords.ofImage(expected.getImage()).contains(i,j)) {
    diff.getDiffImage().setRGB(i,j,expected.getImage().getRGB(i,j));
  }
 else   if (Coords.ofImage(actual.getImage()).contains(i,j)) {
    diff.getDiffImage().setRGB(i,j,actual.getImage().getRGB(i,j));
  }
}
Program: 31047
Project: 31047
Buggy source:
protected List<NoFilteringArea> createNotFilteringAreas(BufferedImage image,Set<Coords> coordsToCompare){
  List<NoFilteringArea> noFilteringAreas=new ArrayList<>();
  for (  Coords noFilteringCoords : coordsToCompare) {
    noFilteringAreas.add(new NoFilteringArea(image,noFilteringCoords));
  }
  return noFilteringAreas;
}

Fixed version (ground truth):
protected List<NoFilteringArea> createNotFilteringAreas(BufferedImage image,Set<Coords> coordsToCompare){
  List<NoFilteringArea> noFilteringAreas=new ArrayList<>();
  for (  Coords noFilteringCoords : coordsToCompare) {
    if (noFilteringCoords.intersects(Coords.ofImage(image))) {
      noFilteringAreas.add(new NoFilteringArea(image,noFilteringCoords));
    }
  }
  return noFilteringAreas;
}
Program: 31048
Project: 31048
Buggy source:
@Override public boolean onTouchEvent(MotionEvent event){
  Log.d(VIEW_LOG_TAG,"String_Node_Str" + event.getAction());
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    mYDown=(int)event.getRawY();
  Log.d(VIEW_LOG_TAG,"String_Node_Str");
break;
case MotionEvent.ACTION_MOVE:
Log.d(VIEW_LOG_TAG,"String_Node_Str");
int currentY=(int)event.getRawY();
mYDistance=currentY - mYDown;
Log.d(VIEW_LOG_TAG,"String_Node_Str" + mTouchSlop + "String_Node_Str"+ mYDistance);
showStatus(mCurrentStatus);
if (mYDistance >= mTouchSlop) {
if (mCurrentStatus != STATUS_REFRESHING) {
if (mHeaderView.getPaddingTop() > mHeaderViewHeight * 0.7f) {
mCurrentStatus=STATUS_RELEASE_TO_REFRESH;
mTipsTextView.setText(R.string.pull_to_refresh_release_label);
}
 else {
mCurrentStatus=STATUS_PULL_TO_REFRESH;
mTipsTextView.setText(R.string.pull_to_refresh_pull_label);
}
}
rotateHeaderArrow();
int scaleHeight=(int)(mYDistance * 0.8f);
if (scaleHeight <= mScrHeight / 4) {
adjustHeaderPadding(scaleHeight);
}
}
break;
case MotionEvent.ACTION_UP:
doRefresh();
break;
default :
break;
}
return true;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent event){
  Log.d(VIEW_LOG_TAG,"String_Node_Str" + event.getAction());
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    mYDown=(int)event.getRawY();
  Log.d(VIEW_LOG_TAG,"String_Node_Str");
break;
case MotionEvent.ACTION_MOVE:
Log.d(VIEW_LOG_TAG,"String_Node_Str");
int currentY=(int)event.getRawY();
mYDistance=currentY - mYDown;
Log.d(VIEW_LOG_TAG,"String_Node_Str" + mTouchSlop + "String_Node_Str"+ mYDistance);
showStatus(mCurrentStatus);
if (Math.abs(mYDistance) >= mTouchSlop) {
if (mCurrentStatus != STATUS_REFRESHING) {
if (mHeaderView.getPaddingTop() > mHeaderViewHeight * 0.7f) {
mCurrentStatus=STATUS_RELEASE_TO_REFRESH;
mTipsTextView.setText(R.string.pull_to_refresh_release_label);
}
 else {
mCurrentStatus=STATUS_PULL_TO_REFRESH;
mTipsTextView.setText(R.string.pull_to_refresh_pull_label);
}
}
rotateHeaderArrow();
int scaleHeight=(int)(mYDistance * 0.8f);
if (scaleHeight <= mScrHeight / 4) {
adjustHeaderPadding(scaleHeight);
}
}
break;
case MotionEvent.ACTION_UP:
doRefresh();
break;
default :
break;
}
return true;
}
Program: 31049
Project: 31049
Buggy source:
@Override public void success(K k,Response response){
  int nextPage=getLinkData(response);
  if (nextPage != -1) {
    subscriber.onNext(k);
    executePaginated(nextPage);
  }
 else {
    subscriber.onCompleted();
  }
}

Fixed version (ground truth):
@Override public void success(K k,Response response){
  int nextPage=getLinkData(response);
  subscriber.onNext(k);
  if (nextPage != -1) {
    executePaginated(nextPage);
  }
 else {
    subscriber.onCompleted();
  }
}
Program: 31050
Project: 31050
Buggy source:
public EditGistCommentClient(Context context,String gistId,String commentId,String body){
  super(context);
  this.gistId=gistId;
  this.body=body;
  this.commentId=commentId;
}

Fixed version (ground truth):
public EditGistCommentClient(Context context,String gistId,String commentId,CommentRequest body){
  super(context);
  this.gistId=gistId;
  this.body=body;
  this.commentId=commentId;
}
Program: 31051
Project: 31051
Buggy source:
@POST("String_Node_Str") GithubComment editComment(@Path("String_Node_Str") String gistId,@Path("String_Node_Str") String commentId,@Field("String_Node_Str") String body);

Fixed version (ground truth):
@POST("String_Node_Str") GithubComment editComment(@Path("String_Node_Str") String gistId,@Path("String_Node_Str") String commentId,@Body CommentRequest body);
Program: 31052
Project: 31052
Buggy source:
@POST("String_Node_Str") GithubComment publishComment(@Path("String_Node_Str") String id,@Field("String_Node_Str") String comment);

Fixed version (ground truth):
@POST("String_Node_Str") GithubComment publishComment(@Path("String_Node_Str") String id,@Body CommentRequest body);
Program: 31053
Project: 31053
Buggy source:
public PublishGistCommentClient(Context context,String id,String comment){
  super(context);
  this.id=id;
  this.comment=comment;
}

Fixed version (ground truth):
public PublishGistCommentClient(Context context,String id,CommentRequest comment){
  super(context);
  this.id=id;
  this.comment=comment;
}
Program: 31054
Project: 31054
Buggy source:
public EditIssueCommentClient(Context context,RepoInfo info,String id,String body){
  super(context);
  this.info=info;
  this.id=id;
  this.body=body;
}

Fixed version (ground truth):
public EditIssueCommentClient(Context context,RepoInfo info,String id,CommentRequest body){
  super(context);
  this.info=info;
  this.id=id;
  this.body=body;
}
Program: 31055
Project: 31055
Buggy source:
@Override protected GithubComment executeServiceSync(RestAdapter restAdapter){
  return restAdapter.create(IssuesService.class).editComment(info.owner,info.name,body,id);
}

Fixed version (ground truth):
@Override protected GithubComment executeServiceSync(RestAdapter restAdapter){
  return restAdapter.create(IssuesService.class).editComment(info.owner,info.name,id,body);
}
Program: 31056
Project: 31056
Buggy source:
@PATCH("String_Node_Str") GithubComment editComment(@Path("String_Node_Str") String owner,@Path("String_Node_Str") String name,@Path("String_Node_Str") String id,@Field("String_Node_Str") String body);

Fixed version (ground truth):
@PATCH("String_Node_Str") GithubComment editComment(@Path("String_Node_Str") String owner,@Path("String_Node_Str") String name,@Path("String_Node_Str") String id,@Body CommentRequest body);
Program: 31057
Project: 31057
Buggy source:
@Override public Response execute(Request request) throws IOException {
  StoreCredentials storeCredentials=new StoreCredentials(context);
  HttpClient httpclient=new DefaultHttpClient();
  HttpPost httppost=new HttpPost(request.getUrl());
  httppost.setHeader("String_Node_Str","String_Node_Str");
  httppost.setHeader("String_Node_Str","String_Node_Str");
  httppost.setHeader("String_Node_Str","String_Node_Str" + storeCredentials.token());
  httppost.setEntity(new StringEntity(readme.text));
  HttpResponse response=httpclient.execute(httppost);
  final String inputStreamString=new Scanner(response.getEntity().getContent(),"String_Node_Str").useDelimiter("String_Node_Str").next();
  handler.post(new Runnable(){
    @Override public void run(){
      if (onResultCallback != null) {
        onResultCallback.onResponseOk(inputStreamString,null);
      }
    }
  }
);
  return null;
}

Fixed version (ground truth):
@Override public Response execute(Request request) throws IOException {
  StoreCredentials storeCredentials=new StoreCredentials(context);
  HttpClient httpclient=new DefaultHttpClient();
  HttpPost httppost=new HttpPost(request.getUrl());
  httppost.setHeader("String_Node_Str","String_Node_Str");
  httppost.setHeader("String_Node_Str","String_Node_Str");
  httppost.setHeader("String_Node_Str","String_Node_Str" + storeCredentials.token());
  httppost.setEntity(new StringEntity(readme.text,"String_Node_Str"));
  HttpResponse response=httpclient.execute(httppost);
  final String inputStreamString=new Scanner(response.getEntity().getContent(),"String_Node_Str").useDelimiter("String_Node_Str").next();
  handler.post(new Runnable(){
    @Override public void run(){
      if (onResultCallback != null) {
        onResultCallback.onResponseOk(inputStreamString,null);
      }
    }
  }
);
  return null;
}
Program: 31058
Project: 31058
Buggy source:
@Override protected void executeService(RestAdapter restAdapter){
  OrgsService orgsService=restAdapter.create(OrgsService.class);
  if (page == -1) {
    if (username == null) {
      orgsService.orgs(this);
    }
 else {
      orgsService.orgsByUser(username,this);
    }
  }
 else {
    if (username == null) {
      orgsService.orgs(page,this);
    }
 else {
      orgsService.orgsByUser(username,page,this);
    }
  }
}

Fixed version (ground truth):
@Override protected void executeService(RestAdapter restAdapter){
  StoreCredentials settings=new StoreCredentials(getContext());
  if (username != null && username.equalsIgnoreCase(settings.getUserName())) {
    username=null;
  }
  OrgsService orgsService=restAdapter.create(OrgsService.class);
  if (page == -1) {
    if (username == null) {
      orgsService.orgs(this);
    }
 else {
      orgsService.orgsByUser(username,this);
    }
  }
 else {
    if (username == null) {
      orgsService.orgs(page,this);
    }
 else {
      orgsService.orgsByUser(username,page,this);
    }
  }
}
Program: 31059
Project: 31059
Buggy source:
@Override public SortedMap<String,Integer> GetParameterMap(Netlist Nets,NetlistComponent ComponentInfo,FPGAReport Reporter){
  SortedMap<String,Integer> ParameterMap=new TreeMap<String,Integer>();
  int NrOfBits=ComponentInfo.GetComponent().getAttributeSet().getValue(Multiplier.WIDTH_ATTR).getWidth();
  ParameterMap.put(NrOfBitsStr,NrOfBits);
  ParameterMap.put(CalcBitsStr,2 * NrOfBits);
  return ParameterMap;
}

Fixed version (ground truth):
@Override public SortedMap<String,Integer> GetParameterMap(Netlist Nets,NetlistComponent ComponentInfo,FPGAReport Reporter){
  SortedMap<String,Integer> ParameterMap=new TreeMap<String,Integer>();
  int NrOfBits=ComponentInfo.GetComponent().getEnd(0).getWidth().getWidth();
  ParameterMap.put(NrOfBitsStr,NrOfBits);
  ParameterMap.put(CalcBitsStr,2 * NrOfBits);
  return ParameterMap;
}
Program: 31060
Project: 31060
Buggy source:
public Multiplier(){
  super("String_Node_Str",Strings.getter("String_Node_Str"));
  setAttributes(new Attribute[]{WIDTH_ATTR},new Object[]{BitWidth.create(8)});
  setKeyConfigurator(new BitWidthConfigurator(WIDTH_ATTR));
  setOffsetBounds(Bounds.create(-40,-20,40,40));
  setIconName("String_Node_Str");
  Port[] ps=new Port[5];
  ps[IN0]=new Port(-40,-10,Port.INPUT,WIDTH_ATTR);
  ps[IN1]=new Port(-40,10,Port.INPUT,WIDTH_ATTR);
  ps[OUT]=new Port(0,0,Port.OUTPUT,WIDTH_ATTR);
  ps[C_IN]=new Port(-20,-20,Port.INPUT,WIDTH_ATTR);
  ps[C_OUT]=new Port(-20,20,Port.OUTPUT,WIDTH_ATTR);
  ps[IN0].setToolTip(Strings.getter("String_Node_Str"));
  ps[IN1].setToolTip(Strings.getter("String_Node_Str"));
  ps[OUT].setToolTip(Strings.getter("String_Node_Str"));
  ps[C_IN].setToolTip(Strings.getter("String_Node_Str"));
  ps[C_OUT].setToolTip(Strings.getter("String_Node_Str"));
  setPorts(ps);
}

Fixed version (ground truth):
public Multiplier(){
  super("String_Node_Str",Strings.getter("String_Node_Str"));
  setAttributes(new Attribute[]{StdAttr.WIDTH},new Object[]{BitWidth.create(8)});
  setKeyConfigurator(new BitWidthConfigurator(StdAttr.WIDTH));
  setOffsetBounds(Bounds.create(-40,-20,40,40));
  setIconName("String_Node_Str");
  Port[] ps=new Port[5];
  ps[IN0]=new Port(-40,-10,Port.INPUT,StdAttr.WIDTH);
  ps[IN1]=new Port(-40,10,Port.INPUT,StdAttr.WIDTH);
  ps[OUT]=new Port(0,0,Port.OUTPUT,StdAttr.WIDTH);
  ps[C_IN]=new Port(-20,-20,Port.INPUT,StdAttr.WIDTH);
  ps[C_OUT]=new Port(-20,20,Port.OUTPUT,StdAttr.WIDTH);
  ps[IN0].setToolTip(Strings.getter("String_Node_Str"));
  ps[IN1].setToolTip(Strings.getter("String_Node_Str"));
  ps[OUT].setToolTip(Strings.getter("String_Node_Str"));
  ps[C_IN].setToolTip(Strings.getter("String_Node_Str"));
  ps[C_OUT].setToolTip(Strings.getter("String_Node_Str"));
  setPorts(ps);
}
Program: 31061
Project: 31061
Buggy source:
@Override public void propagate(InstanceState state){
  BitWidth dataWidth=state.getAttributeValue(WIDTH_ATTR);
  Value a=state.getPortValue(IN0);
  Value b=state.getPortValue(IN1);
  Value c_in=state.getPortValue(C_IN);
  Value[] outs=Multiplier.computeProduct(dataWidth,a,b,c_in);
  int delay=dataWidth.getWidth() * (dataWidth.getWidth() + 2) * PER_DELAY;
  state.setPort(OUT,outs[0],delay);
  state.setPort(C_OUT,outs[1],delay);
}

Fixed version (ground truth):
@Override public void propagate(InstanceState state){
  BitWidth dataWidth=state.getAttributeValue(StdAttr.WIDTH);
  Value a=state.getPortValue(IN0);
  Value b=state.getPortValue(IN1);
  Value c_in=state.getPortValue(C_IN);
  Value[] outs=Multiplier.computeProduct(dataWidth,a,b,c_in);
  int delay=dataWidth.getWidth() * (dataWidth.getWidth() + 2) * PER_DELAY;
  state.setPort(OUT,outs[0],delay);
  state.setPort(C_OUT,outs[1],delay);
}
Program: 31062
Project: 31062
Buggy source:
static Value[] computeProduct(BitWidth width,Value a,Value b,Value c_in){
  int w=width.getWidth();
  if (c_in == Value.NIL || c_in.isUnknown())   c_in=Value.createKnown(width,0);
  if (a.isFullyDefined() && b.isFullyDefined() && c_in.isFullyDefined()) {
    long sum=(long)a.toIntValue() * (long)b.toIntValue() + (long)c_in.toIntValue();
    return new Value[]{Value.createKnown(width,(int)sum),Value.createKnown(width,(int)(sum >> w))};
  }
 else {
    Value[] avals=a.getAll();
    int aOk=findUnknown(avals);
    int aErr=findError(avals);
    int ax=getKnown(avals);
    Value[] bvals=b.getAll();
    int bOk=findUnknown(bvals);
    int bErr=findError(bvals);
    int bx=getKnown(bvals);
    Value[] cvals=c_in.getAll();
    int cOk=findUnknown(cvals);
    int cErr=findError(cvals);
    int cx=getKnown(cvals);
    int known=Math.min(Math.min(aOk,bOk),cOk);
    int error=Math.min(Math.min(aErr,bErr),cErr);
    int ret=ax * bx + cx;
    Value[] bits=new Value[w];
    for (int i=0; i < w; i++) {
      if (i < known) {
        bits[i]=((ret & (1 << i)) != 0 ? Value.TRUE : Value.FALSE);
      }
 else       if (i < error) {
        bits[i]=Value.UNKNOWN;
      }
 else {
        bits[i]=Value.ERROR;
      }
    }
    return new Value[]{Value.create(bits),error < w ? Value.createError(width) : Value.createUnknown(width)};
  }
}

Fixed version (ground truth):
static Value[] computeProduct(BitWidth width,Value a,Value b,Value c_in){
  int w=width.getWidth();
  if (c_in == Value.NIL || c_in.isUnknown())   c_in=Value.createKnown(width,0);
  if (a.isFullyDefined() && b.isFullyDefined() && c_in.isFullyDefined()) {
    long sum;
    if (w >= 32) {
      sum=(a.toIntValue() & 0xffffffffL) * (b.toIntValue() & 0xffffffffL) + (c_in.toIntValue() & 0xffffffffL);
    }
 else {
      sum=(long)a.toIntValue() * (long)b.toIntValue() + (long)c_in.toIntValue();
    }
    return new Value[]{Value.createKnown(width,(int)sum),Value.createKnown(width,(int)(sum >> w))};
  }
 else {
    Value[] avals=a.getAll();
    int aOk=findUnknown(avals);
    int aErr=findError(avals);
    int ax=getKnown(avals);
    Value[] bvals=b.getAll();
    int bOk=findUnknown(bvals);
    int bErr=findError(bvals);
    int bx=getKnown(bvals);
    Value[] cvals=c_in.getAll();
    int cOk=findUnknown(cvals);
    int cErr=findError(cvals);
    int cx=getKnown(cvals);
    int known=Math.min(Math.min(aOk,bOk),cOk);
    int error=Math.min(Math.min(aErr,bErr),cErr);
    int ret=ax * bx + cx;
    Value[] bits=new Value[w];
    for (int i=0; i < w; i++) {
      if (i < known) {
        bits[i]=((ret & (1 << i)) != 0 ? Value.TRUE : Value.FALSE);
      }
 else       if (i < error) {
        bits[i]=Value.UNKNOWN;
      }
 else {
        bits[i]=Value.ERROR;
      }
    }
    return new Value[]{Value.create(bits),error < w ? Value.createError(width) : Value.createUnknown(width)};
  }
}
Program: 31063
Project: 31063
Buggy source:
public void LabelChanged(ComponentEvent e){
  AttributeEvent attre=(AttributeEvent)e.getData();
  if (attre.getSource() == null || attre.getValue() == null) {
    return;
  }
  String newLabel=(String)attre.getValue();
  String oldLabel=attre.getOldValue() != null ? (String)attre.getOldValue() : "String_Node_Str";
  @SuppressWarnings("String_Node_Str") Attribute<String> lattr=(Attribute<String>)attre.getAttribute();
  if (!IsCorrectLabel(newLabel,comps,attre.getSource(),e.getSource().getFactory(),true))   attre.getSource().setValue(lattr,oldLabel);
}

Fixed version (ground truth):
public void LabelChanged(ComponentEvent e){
  AttributeEvent attre=(AttributeEvent)e.getData();
  if (attre.getSource() == null || attre.getValue() == null) {
    return;
  }
  String newLabel=(String)attre.getValue();
  String oldLabel=attre.getOldValue() != null ? (String)attre.getOldValue() : "String_Node_Str";
  @SuppressWarnings("String_Node_Str") Attribute<String> lattr=(Attribute<String>)attre.getAttribute();
  if (!IsCorrectLabel(newLabel,comps,attre.getSource(),e.getSource().getFactory(),true)) {
    if (IsCorrectLabel(oldLabel,comps,attre.getSource(),e.getSource().getFactory(),false))     attre.getSource().setValue(lattr,oldLabel);
 else     attre.getSource().setValue(lattr,"String_Node_Str");
  }
}
Program: 31064
Project: 31064
Buggy source:
public void LabelChanged(ComponentEvent e){
  AttributeEvent attre=(AttributeEvent)e.getData();
  if (attre.getSource() == null || attre.getValue() == null) {
    return;
  }
  String newLabel=(String)attre.getValue();
  String oldLabel=attre.getOldValue() != null ? (String)attre.getOldValue() : "String_Node_Str";
  @SuppressWarnings("String_Node_Str") Attribute<String> lattr=(Attribute<String>)attre.getAttribute();
  if (!IsCorrectLabel(newLabel,comps,attre.getSource(),e.getSource().getFactory(),true))   attre.getSource().setValue(lattr,oldLabel);
}

Fixed version (ground truth):
public void LabelChanged(ComponentEvent e){
  AttributeEvent attre=(AttributeEvent)e.getData();
  if (attre.getSource() == null || attre.getValue() == null) {
    return;
  }
  String newLabel=(String)attre.getValue();
  String oldLabel=attre.getOldValue() != null ? (String)attre.getOldValue() : "String_Node_Str";
  @SuppressWarnings("String_Node_Str") Attribute<String> lattr=(Attribute<String>)attre.getAttribute();
  if (!IsCorrectLabel(newLabel,comps,attre.getSource(),e.getSource().getFactory(),true)) {
    if (IsCorrectLabel(oldLabel,comps,attre.getSource(),e.getSource().getFactory(),false))     attre.getSource().setValue(lattr,oldLabel);
 else     attre.getSource().setValue(lattr,"String_Node_Str");
  }
}
Program: 31066
Project: 31066
Buggy source:
boolean concernsSupercircuit(){
switch (type) {
case CLEAR:
    return true;
case ADD:
case REMOVE:
  return comp.getFactory() instanceof Pin;
case ADD_ALL:
case REMOVE_ALL:
for (Component comp : comps) {
  if (comp.getFactory() instanceof Pin)   return true;
}
return false;
case REPLACE:
ReplacementMap repl=(ReplacementMap)newValue;
for (Component comp : repl.getRemovals()) {
if (comp.getFactory() instanceof Pin) return true;
}
for (Component comp : repl.getAdditions()) {
if (comp.getFactory() instanceof Pin) return true;
}
return false;
case SET:
return comp.getFactory() instanceof Pin && (attr == StdAttr.WIDTH || attr == Pin.ATTR_TYPE);
case SET_FOR_CIRCUIT:
return (attr == CircuitAttributes.NAME_ATTR || attr == CircuitAttributes.NAMED_CIRCUIT_BOX);
default :
return false;
}
}

Fixed version (ground truth):
boolean concernsSupercircuit(){
switch (type) {
case CLEAR:
    return true;
case ADD:
case REMOVE:
  return comp.getFactory() instanceof Pin;
case ADD_ALL:
case REMOVE_ALL:
for (Component comp : comps) {
  if (comp.getFactory() instanceof Pin)   return true;
}
return false;
case REPLACE:
ReplacementMap repl=(ReplacementMap)newValue;
for (Component comp : repl.getRemovals()) {
if (comp.getFactory() instanceof Pin) return true;
}
for (Component comp : repl.getAdditions()) {
if (comp.getFactory() instanceof Pin) return true;
}
return false;
case SET:
return comp.getFactory() instanceof Pin && (attr == StdAttr.WIDTH || attr == Pin.ATTR_TYPE || attr == StdAttr.LABEL);
case SET_FOR_CIRCUIT:
return (attr == CircuitAttributes.NAME_ATTR || attr == CircuitAttributes.NAMED_CIRCUIT_BOX);
default :
return false;
}
}
Program: 31068
Project: 31068
Buggy source:
public void setDimensions(int addrBits,int width,boolean IsRom){
  if (addrBits == this.addrBits && width == this.width)   return;
  this.addrBits=addrBits;
  this.width=width;
  this.mask=width == 32 ? 0xffffffff : ((1 << width) - 1);
  MemContentsSub.ContentsInterface[] oldPages=pages;
  int pageCount;
  int pageLength;
  if (addrBits < PAGE_SIZE_BITS) {
    pageCount=1;
    pageLength=1 << addrBits;
  }
 else {
    pageCount=1 << (addrBits - PAGE_SIZE_BITS);
    pageLength=PAGE_SIZE;
  }
  pages=new MemContentsSub.ContentsInterface[pageCount];
  if (oldPages != null) {
    int n=Math.min(oldPages.length,pages.length);
    for (int i=0; i < n; i++) {
      if (oldPages[i] != null) {
        pages[i]=MemContentsSub.createContents(pageLength,width);
        int m=Math.max(oldPages[i].getLength(),pageLength);
        for (int j=0; j < m; j++) {
          pages[i].set(j,oldPages[i].get(j));
        }
      }
    }
  }
 else   if (AppPreferences.Memory_Startup_Unknown.get() && !IsRom) {
    for (int i=0; i < pageCount; i++)     pages[i]=MemContentsSub.createContents(pageLength,width);
  }
  if (pageCount == 0 && pages[0] == null) {
    pages[0]=MemContentsSub.createContents(pageLength,width);
  }
  fireMetainfoChanged();
}

Fixed version (ground truth):
public void setDimensions(int addrBits,int width,boolean IsRom){
  if (addrBits == this.addrBits && width == this.width)   return;
  this.addrBits=addrBits;
  this.width=width;
  this.mask=width == 32 ? 0xffffffff : ((1 << width) - 1);
  MemContentsSub.ContentsInterface[] oldPages=pages;
  int pageCount;
  int pageLength;
  if (addrBits < PAGE_SIZE_BITS) {
    pageCount=1;
    pageLength=1 << addrBits;
  }
 else {
    pageCount=1 << (addrBits - PAGE_SIZE_BITS);
    pageLength=PAGE_SIZE;
  }
  pages=new MemContentsSub.ContentsInterface[pageCount];
  if (oldPages != null) {
    int n=Math.min(oldPages.length,pages.length);
    for (int i=0; i < n; i++) {
      if (oldPages[i] != null) {
        pages[i]=MemContentsSub.createContents(pageLength,width);
        int m=Math.min(oldPages[i].getLength(),pageLength);
        for (int j=0; j < m; j++) {
          pages[i].set(j,oldPages[i].get(j));
        }
      }
    }
    if (AppPreferences.Memory_Startup_Unknown.get() && !IsRom) {
      for (int i=oldPages.length; i < pages.length; i++)       pages[i]=MemContentsSub.createContents(pageLength,width);
    }
  }
 else   if (AppPreferences.Memory_Startup_Unknown.get() && !IsRom) {
    for (int i=0; i < pageCount; i++)     pages[i]=MemContentsSub.createContents(pageLength,width);
  }
  if (pageCount == 0 && pages[0] == null) {
    pages[0]=MemContentsSub.createContents(pageLength,width);
  }
  fireMetainfoChanged();
}