nus-yam/ex-repair huggingface dataset:
Program: 30939
Project: 30939
Buggy source:
public String unenrollStudent(int studentId,int classId){
  String errorString="String_Node_Str" + studentId + "String_Node_Str"+ classId+ "String_Node_Str";
  if (!students.containsKey(studentId) || !courses.containsKey(classId)) {
    return errorString;
  }
  Student student=students.get(studentId);
  Course course=courses.get(classId);
  if (!student.courses.contains(classId)) {
    student.courses.remove(classId);
    student.timeSlots.add(course.time);
    course.students.remove(studentId);
    course.remainCapacity++;
  }
  return "String_Node_Str" + classId + "String_Node_Str"+ course.remainCapacity;
}

Fixed version (ground truth):
public String unenrollStudent(int studentId,int classId){
  String errorString="String_Node_Str" + studentId + "String_Node_Str"+ classId+ "String_Node_Str";
  if (!students.containsKey(studentId) || !courses.containsKey(classId)) {
    return errorString;
  }
  Student student=students.get(studentId);
  Course course=courses.get(classId);
  if (student.courses.contains(classId)) {
    student.courses.remove(classId);
    student.takeTimeSlots.remove(course.time);
    student.capacity++;
    course.students.remove(studentId);
    course.remainCapacity++;
  }
 else {
    return errorString;
  }
  return "String_Node_Str" + classId + "String_Node_Str"+ course.remainCapacity;
}
Program: 30940
Project: 30940
Buggy source:
public String infoStudent(int id){
  if (!students.containsKey(id)) {
    return "String_Node_Str" + id + "String_Node_Str";
  }
  Student student=students.get(id);
  StringBuilder courseList=new StringBuilder();
  for (  Integer courseId : student.courses) {
    courseList.append(courseId + "String_Node_Str");
  }
  courseList.deleteCharAt(courseList.length() - 1);
  return "String_Node_Str" + id + "String_Node_Str"+ courseList.toString();
}

Fixed version (ground truth):
public static String infoStudent(int id){
  if (!students.containsKey(id)) {
    return "String_Node_Str" + id + "String_Node_Str";
  }
  Student student=students.get(id);
  StringBuilder courseList=new StringBuilder();
  for (  Integer courseId : student.courses) {
    courseList.append(courseId + "String_Node_Str");
  }
  if (courseList.length() == 0) {
    return "String_Node_Str" + id + "String_Node_Str";
  }
  courseList.deleteCharAt(courseList.length() - 1);
  return "String_Node_Str" + id + "String_Node_Str"+ courseList.toString();
}
Program: 30941
Project: 30941
Buggy source:
public String removeClass(int id){
  if (!courses.containsKey(id)) {
    return "String_Node_Str" + id;
  }
  Course course=courses.get(id);
  for (  Integer stuId : course.students) {
    Student student=students.get(stuId);
    if (student != null) {
      student.courses.remove(id);
      student.timeSlots.remove(course.time);
    }
  }
  courses.remove(id);
  return "String_Node_Str" + id;
}

Fixed version (ground truth):
public static String removeClass(int id){
  if (!courses.containsKey(id)) {
    return "String_Node_Str" + id;
  }
  Course course=courses.get(id);
  for (  Integer stuId : course.students) {
    Student student=students.get(stuId);
    if (student != null) {
      student.courses.remove(id);
      student.takeTimeSlots.remove(course.time);
      student.capacity++;
    }
  }
  courses.remove(id);
  return "String_Node_Str" + id;
}
Program: 30942
Project: 30942
Buggy source:
public String removeStudent(int id){
  if (!students.containsKey(id)) {
    return "String_Node_Str" + id;
  }
  Student student=students.get(id);
  for (  Integer courseId : student.courses) {
    Course course=courses.get(courseId);
    if (course != null) {
      course.students.remove(id);
      course.remainCapacity++;
    }
  }
  students.remove(id);
  return "String_Node_Str" + id;
}

Fixed version (ground truth):
public static String removeStudent(int id){
  if (!students.containsKey(id)) {
    return "String_Node_Str" + id;
  }
  Student student=students.get(id);
  for (  Integer courseId : student.courses) {
    Course course=courses.get(courseId);
    if (course != null) {
      course.students.remove(id);
      course.remainCapacity++;
    }
  }
  students.remove(id);
  return "String_Node_Str" + id;
}
Program: 30943
Project: 30943
Buggy source:
public Student(){
  super();
}

Fixed version (ground truth):
public Student(int capacity,int startTime,int endTime){
  super();
  this.capacity=capacity;
  this.startTime=startTime;
  this.endTime=endTime;
}
Program: 30944
Project: 30944
Buggy source:
public String enrollStudent(int studentId,int classId){
  String errorString="String_Node_Str" + studentId + "String_Node_Str"+ classId+ "String_Node_Str";
  if (!students.containsKey(studentId) || !courses.containsKey(classId)) {
    return errorString;
  }
  Student student=students.get(studentId);
  Course course=courses.get(classId);
  if (student.courses.contains(classId) || student.timeSlots.size() == 0 || course.remainCapacity <= 0 || !student.timeSlots.contains(course.time)) {
    return errorString;
  }
  course.remainCapacity--;
  student.timeSlots.remove(course.time);
  return "String_Node_Str" + classId + "String_Node_Str"+ course.remainCapacity;
}

Fixed version (ground truth):
public static String enrollStudent(int studentId,int classId){
  String errorString="String_Node_Str" + studentId + "String_Node_Str"+ classId+ "String_Node_Str";
  if (!students.containsKey(studentId) || !courses.containsKey(classId)) {
    return errorString;
  }
  Student student=students.get(studentId);
  Course course=courses.get(classId);
  if (course.remainCapacity <= 0) {
    return "String_Node_Str" + classId + "String_Node_Str";
  }
  if (student.courses.contains(classId) || student.capacity == 0 || student.takeTimeSlots.contains(course.time) || (course.time < student.startTime && course.time > student.endTime)) {
    return errorString;
  }
  course.remainCapacity--;
  course.students.add(studentId);
  student.takeTimeSlots.add(course.time);
  student.courses.add(classId);
  student.capacity--;
  return "String_Node_Str" + classId + "String_Node_Str"+ course.remainCapacity;
}
Program: 30945
Project: 30945
Buggy source:
public static ArrayList<Integer> findEqual(int[] input){
  ArrayList<Integer> ret=new ArrayList<Integer>();
  int l=0;
  int r=input.length - 1;
  while (l < r - 1) {
    int mid=l + (r - l) / 2;
    if (input[mid] >= mid) {
      r=mid;
    }
 else {
      l=mid;
    }
  }
  int leftBound=l == input[l] ? l : r;
  l=0;
  r=input.length - 1;
  while (l < r - 1) {
    int mid=l + (r - l) / 2;
    if (input[mid] <= mid) {
      l=mid;
    }
 else {
      r=mid;
    }
  }
  int rightBound=r == input[l] ? r : l;
  for (int i=leftBound; i <= rightBound; i++) {
    ret.add(i);
  }
  return ret;
}

Fixed version (ground truth):
public static ArrayList<Integer> findEqual(int[] input){
  ArrayList<Integer> ret=new ArrayList<Integer>();
  int l=0;
  int r=input.length - 1;
  while (l < r - 1) {
    int mid=l + (r - l) / 2;
    if (input[mid] >= mid) {
      r=mid;
    }
 else {
      l=mid;
    }
  }
  int leftBound=l == input[l] ? l : r;
  l=0;
  r=input.length - 1;
  while (l < r - 1) {
    int mid=l + (r - l) / 2;
    if (input[mid] <= mid) {
      l=mid;
    }
 else {
      r=mid;
    }
  }
  int rightBound=r == input[r] ? r : l;
  for (int i=leftBound; i <= rightBound; i++) {
    ret.add(i);
  }
  return ret;
}
Program: 30946
Project: 30946
Buggy source:
public static void main(String[] str){
  int[] input={-4,-3,-2,-1,3,4,6,7,9,10,11,12};
  System.out.println(findEqual(input));
}

Fixed version (ground truth):
public static void main(String[] str){
  int[] input={-4,-3,-2,-1,3,4,6,7,9,10,11,12};
  System.out.println(findEqual(input));
  int[] input2={-4,-3,-2,-1,3,4,6,7,8,9,10,11};
  System.out.println(findEqual(input2));
}
Program: 30947
Project: 30947
Buggy source:
private void setupBitcoinSyncNotification(){
  balance.setStyle("String_Node_Str");
  TorClient torClient=Main.bitcoin.getPeers().getTorClient();
  if (torClient != null) {
    SimpleDoubleProperty torProgress=new SimpleDoubleProperty(-1);
    String torMsg=tr("String_Node_Str");
    syncItem=Main.instance.notificationBar.displayNewItem(torMsg,torProgress);
    torClient.addInitializationListener(new TorInitializationListener(){
      @Override public void initializationProgress(      String message,      int percent){
        Platform.runLater(() -> {
          syncItem.label.set(torMsg + "String_Node_Str" + message);
          torProgress.set(percent / 100.0);
        }
);
      }
      @Override public void initializationCompleted(){
        Platform.runLater(() -> {
          syncItem.cancel();
          showBitcoinSyncMessage();
        }
);
      }
    }
);
  }
  bitcoinUIModel.syncProgressProperty().addListener(x -> {
    double progress=bitcoinUIModel.syncProgressProperty().get();
    if (progress >= 1.0) {
      if (syncItem != null) {
        GuiUtils.runOnGuiThreadAfter(500,() -> {
          syncItem.cancel();
          syncItem=null;
          balance.setStyle("String_Node_Str");
        }
);
      }
    }
 else     if (syncItem == null && progress < 1.0) {
      showBitcoinSyncMessage();
    }
  }
);
}

Fixed version (ground truth):
private void setupBitcoinSyncNotification(){
  balance.setStyle("String_Node_Str");
  TorClient torClient=Main.bitcoin.getPeers().getTorClient();
  if (torClient != null) {
    SimpleDoubleProperty torProgress=new SimpleDoubleProperty(-1);
    String torMsg=tr("String_Node_Str");
    syncItem=Main.instance.notificationBar.displayNewItem(torMsg,torProgress);
    torClient.addInitializationListener(new TorInitializationListener(){
      @Override public void initializationProgress(      String message,      int percent){
        Platform.runLater(() -> {
          syncItem.label.set(torMsg + "String_Node_Str" + message);
          torProgress.set(percent / 100.0);
        }
);
      }
      @Override public void initializationCompleted(){
        Platform.runLater(() -> {
          syncItem.cancel();
          showBitcoinSyncMessage();
        }
);
      }
    }
);
  }
  bitcoinUIModel.syncProgressProperty().addListener(x -> {
    double progress=bitcoinUIModel.syncProgressProperty().get();
    if (progress >= 1.0) {
      if (syncItem != null) {
        GuiUtils.runOnGuiThreadAfter(500,() -> {
          syncItem.cancel();
          syncItem=null;
          balance.setStyle("String_Node_Str");
        }
);
      }
    }
 else     if (syncItem == null && progress > 0.0 && progress < 1.0) {
      showBitcoinSyncMessage();
    }
  }
);
}
Program: 30948
Project: 30948
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void deserializeWalletExtension(Wallet containingWallet,byte[] data) throws Exception {
  wallet=(PledgingWallet)containingWallet;
  LHWalletProtos.Extension ext=LHWalletProtos.Extension.parseFrom(data);
  log.info("String_Node_Str",ext.getPledgesCount());
  Map<TransactionOutput,LHProtos.Pledge> contractOuts=new HashMap<>();
  for (  LHProtos.Pledge pledge : ext.getPledgesList()) {
    final List<ByteString> txns=pledge.getTransactionsList();
    Transaction tx=new Transaction(wallet.params,txns.get(txns.size() - 1).toByteArray());
    if (tx.getInputs().size() != 1) {
      log.error("String_Node_Str",tx);
      continue;
    }
    final TransactionOutPoint op=tx.getInput(0).getOutpoint();
    final Transaction transaction=wallet.transactions.get(op.getHash());
    checkNotNull(transaction);
    TransactionOutput output=transaction.getOutput((int)op.getIndex());
    checkNotNull(output);
    contractOuts.put(tx.getOutput(0),pledge);
    log.info("String_Node_Str",LHUtils.hashFromPledge(pledge));
    wallet.pledges.put(output,pledge);
  }
  for (  LHProtos.Project project : ext.getProjectsList()) {
    Project p=new Project(project);
    LHProtos.Pledge pledgeForProject=contractOuts.get(p.getOutputs().get(0));
    wallet.projects.put(p,pledgeForProject);
  }
  for (  LHProtos.Pledge pledge : ext.getRevokedPledgesList()) {
    wallet.revokedPledges.put(hashFromPledge(pledge),pledge);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void deserializeWalletExtension(Wallet containingWallet,byte[] data) throws Exception {
  wallet=(PledgingWallet)containingWallet;
  LHWalletProtos.Extension ext=LHWalletProtos.Extension.parseFrom(data);
  log.info("String_Node_Str",ext.getPledgesCount());
  Map<TransactionOutput,LHProtos.Pledge> contractOuts=new HashMap<>();
  for (  LHProtos.Pledge pledge : ext.getPledgesList()) {
    final List<ByteString> txns=pledge.getTransactionsList();
    Transaction pledgeTx=new Transaction(wallet.params,txns.get(txns.size() - 1).toByteArray());
    if (pledgeTx.getInputs().size() != 1) {
      log.error("String_Node_Str",pledgeTx);
      continue;
    }
    final TransactionOutPoint op=pledgeTx.getInput(0).getOutpoint();
    final Transaction transaction=wallet.transactions.get(op.getHash());
    checkNotNull(transaction);
    TransactionOutput output=transaction.getOutput((int)op.getIndex());
    checkNotNull(output);
    contractOuts.put(pledgeTx.getOutput(0).duplicateDetached(),pledge);
    log.info("String_Node_Str",LHUtils.hashFromPledge(pledge));
    wallet.pledges.put(output,pledge);
  }
  for (  LHProtos.Project project : ext.getProjectsList()) {
    Project p=new Project(project);
    TransactionOutput output=p.getOutputs().get(0).duplicateDetached();
    LHProtos.Pledge pledgeForProject=contractOuts.get(output);
    wallet.projects.put(p,pledgeForProject);
  }
  for (  LHProtos.Pledge pledge : ext.getRevokedPledgesList()) {
    wallet.revokedPledges.put(hashFromPledge(pledge),pledge);
  }
}
Program: 30949
Project: 30949
Buggy source:
private PledgingWallet roundtripWallet(PledgingWallet wallet) throws UnreadableWalletException {
  final Protos.Wallet proto=wallet.serialize();
  System.err.println(proto);
  return PledgingWallet.deserialize(proto);
}

Fixed version (ground truth):
private PledgingWallet roundtripWallet(PledgingWallet wallet) throws UnreadableWalletException {
  return PledgingWallet.deserialize(wallet.serialize());
}
Program: 30950
Project: 30950
Buggy source:
@FXML public void saveClicked(){
  Platform.runLater(() -> {
    boolean savingPledge=pledge != null;
    log.info("String_Node_Str",savingPledge ? "String_Node_Str" : "String_Node_Str");
    FileChooser chooser=new FileChooser();
    chooser.setTitle(savingPledge ? tr("String_Node_Str") : tr("String_Node_Str"));
    chooser.setInitialFileName(getFileName());
    GuiUtils.platformFiddleChooser(chooser);
    File file=chooser.showSaveDialog(Main.instance.mainStage);
    if (file == null) {
      log.info("String_Node_Str");
      return;
    }
    Message data=savingPledge ? pledge.getData() : project.getProto();
    log.info("String_Node_Str",pledge != null ? "String_Node_Str" : "String_Node_Str",file);
    try (OutputStream outputStream=new FileOutputStream(file)){
      data.writeTo(outputStream);
      if (savingPledge) {
        pledge.commit(true);
      }
 else       if (!maybeShowServerGuidance())       overlayUI.done();
    }
 catch (    IOException e) {
      GuiUtils.informationalAlert(tr("String_Node_Str"),e.getLocalizedMessage());
    }
  }
);
}

Fixed version (ground truth):
@FXML public void saveClicked(){
  Platform.runLater(() -> {
    boolean savingPledge=pledge != null;
    log.info("String_Node_Str",savingPledge ? "String_Node_Str" : "String_Node_Str");
    FileChooser chooser=new FileChooser();
    chooser.setTitle(savingPledge ? tr("String_Node_Str") : tr("String_Node_Str"));
    chooser.setInitialFileName(getFileName());
    GuiUtils.platformFiddleChooser(chooser);
    File file=chooser.showSaveDialog(Main.instance.mainStage);
    if (file == null) {
      log.info("String_Node_Str");
      return;
    }
    Message data=savingPledge ? pledge.getData() : project.getProto();
    log.info("String_Node_Str",pledge != null ? "String_Node_Str" : "String_Node_Str",file);
    try (OutputStream outputStream=new FileOutputStream(file)){
      data.writeTo(outputStream);
      if (savingPledge) {
        pledge.commit(true);
      }
 else       if (maybeShowServerGuidance()) {
        return;
      }
      overlayUI.done();
    }
 catch (    IOException e) {
      GuiUtils.informationalAlert(tr("String_Node_Str"),e.getLocalizedMessage());
    }
  }
);
}
Program: 30951
Project: 30951
Buggy source:
private void revoke(@Nullable KeyParameter aesKey){
  try {
    PledgingWallet.Revocation revocation=Main.wallet.revokePledge(pledgeToRevoke,aesKey);
    progressBar.setProgress(-1);
    revocation.tx.getConfidence().addEventListener((conf,reason) -> {
      progressBar.setProgress(conf.numBroadcastPeers() / (double)Main.bitcoin.peerGroup().getMinBroadcastConnections());
    }
,Platform::runLater);
    Futures.addCallback(revocation.broadcastFuture,new FutureCallback<Transaction>(){
      @Override public void onSuccess(      @Nullable Transaction result){
        onSuccess.run();
        overlayUI.done();
      }
      @Override public void onFailure(      Throwable t){
        CrashWindow.open(t);
        overlayUI.done();
      }
    }
,Platform::runLater);
  }
 catch (  InsufficientMoneyException e) {
    log.error("String_Node_Str",e);
    informationalAlert("String_Node_Str","String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
private void revoke(@Nullable KeyParameter aesKey){
  try {
    PledgingWallet.Revocation revocation=Main.wallet.revokePledge(pledgeToRevoke,aesKey);
    progressBar.setProgress(-1);
    revocation.broadcast.setProgressCallback(progressBar::setProgress,Platform::runLater);
    Futures.addCallback(revocation.broadcast.future(),new FutureCallback<Transaction>(){
      @Override public void onSuccess(      @Nullable Transaction result){
        onSuccess.run();
        overlayUI.done();
      }
      @Override public void onFailure(      Throwable t){
        informationalAlert("String_Node_Str","String_Node_Str",t);
        log.error("String_Node_Str",t);
        overlayUI.done();
      }
    }
,Platform::runLater);
  }
 catch (  InsufficientMoneyException e) {
    log.error("String_Node_Str",e);
    informationalAlert("String_Node_Str","String_Node_Str" + "String_Node_Str");
  }
}
Program: 30952
Project: 30952
Buggy source:
@Override public void onFailure(Throwable t){
  CrashWindow.open(t);
  overlayUI.done();
}

Fixed version (ground truth):
@Override public void onFailure(Throwable t){
  informationalAlert("String_Node_Str","String_Node_Str",t);
  log.error("String_Node_Str",t);
  overlayUI.done();
}
Program: 30953
Project: 30953
Buggy source:
private void broadcastClaim(Set<LHProtos.Pledge> pledges,@Nullable KeyParameter key){
  try {
    PledgingWallet.CompletionProgress progress=Main.wallet.completeContractWithFee(projectToClaim,pledges,key);
    double total=Main.bitcoin.peerGroup().getMinBroadcastConnections();
    progress.peersSeen=seen -> {
      if (seen == -1) {
        Platform.runLater(onSuccess::run);
      }
 else {
        progressBar.setProgress(seen / total);
      }
    }
;
    progress.txFuture.handleAsync((t,ex) -> {
      if (ex != null) {
        informationalAlert("String_Node_Str","String_Node_Str",ex);
      }
 else {
        onSuccess.run();
      }
      overlayUI.done();
      return null;
    }
,Platform::runLater);
  }
 catch (  Ex.ValueMismatch e) {
    log.error("String_Node_Str" + e);
    informationalAlert("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",Coin.valueOf(e.byAmount).toFriendlyString());
    overlayUI.done();
  }
catch (  InsufficientMoneyException e) {
    log.error("String_Node_Str",e);
    informationalAlert("String_Node_Str","String_Node_Str" + "String_Node_Str");
    overlayUI.done();
  }
}

Fixed version (ground truth):
private void broadcastClaim(Set<LHProtos.Pledge> pledges,@Nullable KeyParameter key){
  try {
    Main.wallet.completeContractWithFee(projectToClaim,pledges,key,(val) -> {
      progressBar.setProgress(val);
      if (val >= 1.0)       overlayUI.done();
    }
,(ex) -> {
      overlayUI.done();
      informationalAlert("String_Node_Str","String_Node_Str",ex);
    }
,Platform::runLater);
  }
 catch (  Ex.ValueMismatch e) {
    log.error("String_Node_Str" + e);
    informationalAlert("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",Coin.valueOf(e.byAmount).toFriendlyString());
    overlayUI.done();
  }
catch (  InsufficientMoneyException e) {
    log.error("String_Node_Str",e);
    informationalAlert("String_Node_Str","String_Node_Str" + "String_Node_Str");
    overlayUI.done();
  }
}
Program: 30954
Project: 30954
Buggy source:
private boolean checkClaimConfidence(Transaction transaction,TransactionConfidence conf,Project project){
  executor.checkOnThread();
switch (conf.getConfidenceType()) {
case PENDING:
    int seenBy=conf.numBroadcastPeers();
  int minBroadcastConnections=regularP2P.getMinBroadcastConnections();
log.info("String_Node_Str",seenBy,minBroadcastConnections);
if (seenBy < minBroadcastConnections) break;
case BUILDING:
if (conf.getDepthInBlocks() > 3) return true;
if (diskManager.getProjectState(project).state != ProjectState.CLAIMED) {
log.info("String_Node_Str");
diskManager.setProjectState(project,new ProjectStateInfo(ProjectState.CLAIMED,transaction.getHash()));
}
break;
case DEAD:
log.warn("String_Node_Str",conf.getOverridingTransaction());
diskManager.setProjectState(project,new ProjectStateInfo(ProjectState.ERROR,null));
break;
case UNKNOWN:
break;
}
return false;
}

Fixed version (ground truth):
private boolean checkClaimConfidence(Transaction transaction,TransactionConfidence conf,Project project){
  executor.checkOnThread();
switch (conf.getConfidenceType()) {
case PENDING:
    int seenBy=conf.numBroadcastPeers();
  int numConnected=regularP2P.getConnectedPeers().size();
int numToBroadcastTo=(int)Math.max(1,Math.round(Math.ceil(numConnected / 2.0)));
int numWaitingFor=(int)Math.ceil((numConnected - numToBroadcastTo) / 2.0);
log.info("String_Node_Str",seenBy,numWaitingFor);
if (seenBy < numWaitingFor) break;
case BUILDING:
if (conf.getDepthInBlocks() > 3) return true;
if (diskManager.getProjectState(project).state != ProjectState.CLAIMED) {
log.info("String_Node_Str");
diskManager.setProjectState(project,new ProjectStateInfo(ProjectState.CLAIMED,transaction.getHash()));
}
break;
case DEAD:
log.warn("String_Node_Str",conf.getOverridingTransaction());
diskManager.setProjectState(project,new ProjectStateInfo(ProjectState.ERROR,null));
break;
case UNKNOWN:
break;
}
return false;
}
Program: 30955
Project: 30955
Buggy source:
private CompletableFuture<LHProtos.Pledge> broadcastDependenciesOf(LHProtos.Pledge pledge){
  checkArgument(pledge.getTransactionsCount() > 1);
  CompletableFuture<LHProtos.Pledge> result=new CompletableFuture<>();
  log.info("String_Node_Str",pledge.getTransactionsCount() - 1);
  executor.executeASAP(() -> {
    try {
      List<ByteString> txnBytes=pledge.getTransactionsList().subList(0,pledge.getTransactionsCount() - 1);
      if (txnBytes.size() > 5) {
        log.error("String_Node_Str");
        result.completeExceptionally(new Ex.TooManyDependencies(txnBytes.size()));
      }
 else {
        log.info("String_Node_Str",txnBytes.size());
        for (        ByteString txnByte : txnBytes) {
          Transaction tx=new Transaction(wallet.getParams(),txnByte.toByteArray());
          log.info("String_Node_Str",tx.getHash());
          regularP2P.broadcastTransaction(tx).get(30,TimeUnit.SECONDS);
        }
        result.complete(pledge);
      }
    }
 catch (    InterruptedException|TimeoutException|ExecutionException|ProtocolException e) {
      result.completeExceptionally(e);
    }
  }
);
  return result;
}

Fixed version (ground truth):
private CompletableFuture<LHProtos.Pledge> broadcastDependenciesOf(LHProtos.Pledge pledge){
  checkArgument(pledge.getTransactionsCount() > 1);
  CompletableFuture<LHProtos.Pledge> result=new CompletableFuture<>();
  log.info("String_Node_Str",pledge.getTransactionsCount() - 1);
  executor.executeASAP(() -> {
    try {
      List<ByteString> txnBytes=pledge.getTransactionsList().subList(0,pledge.getTransactionsCount() - 1);
      if (txnBytes.size() > 5) {
        log.error("String_Node_Str");
        result.completeExceptionally(new Ex.TooManyDependencies(txnBytes.size()));
      }
 else {
        log.info("String_Node_Str",txnBytes.size());
        for (        ByteString txnByte : txnBytes) {
          Transaction tx=new Transaction(wallet.getParams(),txnByte.toByteArray());
          log.info("String_Node_Str",tx.getHash());
          regularP2P.broadcastTransaction(tx).future().get(30,TimeUnit.SECONDS);
        }
        result.complete(pledge);
      }
    }
 catch (    InterruptedException|TimeoutException|ExecutionException|ProtocolException e) {
      result.completeExceptionally(e);
    }
  }
);
  return result;
}
Program: 30956
Project: 30956
Buggy source:
@Override public void onFailure(Throwable t){
  log.error("String_Node_Str",t);
}

Fixed version (ground truth):
@Override public void onFailure(Throwable t){
  log.error("String_Node_Str",t);
  callbackExecutor.execute(() -> error.accept(t));
}
Program: 30957
Project: 30957
Buggy source:
public Revocation(ListenableFuture<Transaction> broadcastFuture,Transaction tx){
  this.broadcastFuture=broadcastFuture;
  this.tx=tx;
}

Fixed version (ground truth):
public Revocation(TransactionBroadcast broadcast,Transaction tx){
  this.broadcast=broadcast;
  this.tx=tx;
}
Program: 30960
Project: 30960
Buggy source:
@Override public void onSuccess(@Nullable Transaction result){
  log.info("String_Node_Str",hashFromPledge(proto));
  log.info("String_Node_Str",proto.getTransactionsCount());
  updateForRevoke(result,proto,stub);
  saveNow();
  for (  ListenerRegistration<OnRevokeHandler> handler : onRevokeHandlers) {
    handler.executor.execute(() -> handler.listener.onRevoke(proto));
  }
  lock.lock();
  try {
    maybeQueueOnWalletChanged();
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
@Override public void onSuccess(@Nullable Transaction result){
  log.info("String_Node_Str");
}
Program: 30961
Project: 30961
Buggy source:
private void setImageTo(ByteString bytes){
  coverImageView.setEffect(null);
  final Image image=new Image(bytes.newInput(),Project.COVER_IMAGE_WIDTH,Project.COVER_IMAGE_HEIGHT,true,true);
  Exception exception=image.getException();
  if (exception == null) {
    try {
      ByteArrayOutputStream baos=new ByteArrayOutputStream();
      BufferedImage im=SwingFXUtils.fromFXImage(image,null);
      if (System.getProperty("String_Node_Str").equals("String_Node_Str"))       ImageIO.write(im,"String_Node_Str",baos);
 else       ImageIO.write(im,"String_Node_Str",baos);
      byte[] bits=baos.toByteArray();
      model.image.set(ByteString.copyFrom(bits));
      coverImageView.setImage(image);
    }
 catch (    IOException e) {
      exception=e;
    }
  }
  if (exception != null)   log.error("String_Node_Str",exception);
}

Fixed version (ground truth):
private void setImageTo(ByteString bytes){
  coverImageView.setEffect(null);
  final Image image=new Image(bytes.newInput(),Project.COVER_IMAGE_WIDTH,Project.COVER_IMAGE_HEIGHT,true,true);
  Exception exception=image.getException();
  if (exception == null) {
    try {
      ByteArrayOutputStream baos=new ByteArrayOutputStream();
      BufferedImage im=SwingFXUtils.fromFXImage(image,null);
      String ver=System.getProperty("String_Node_Str");
      if (ver.equals("String_Node_Str") || ver.equals("String_Node_Str"))       ImageIO.write(im,"String_Node_Str",baos);
 else       ImageIO.write(im,"String_Node_Str",baos);
      byte[] bits=baos.toByteArray();
      model.image.set(ByteString.copyFrom(bits));
      coverImageView.setImage(image);
    }
 catch (    IOException e) {
      exception=e;
    }
  }
  if (exception != null)   log.error("String_Node_Str",exception);
}
Program: 30962
Project: 30962
Buggy source:
@FXML public void nextClicked(ActionEvent event){
  Platform.runLater(() -> {
    if (!editing && Files.exists(AppDirectory.dir().resolve(Project.getSuggestedFileName(model.title.get())))) {
      informationalAlert("String_Node_Str","String_Node_Str" + "String_Node_Str");
      return;
    }
    AddProjectTypeWindow.open(model,editing);
  }
);
}

Fixed version (ground truth):
@FXML public void nextClicked(ActionEvent event){
  Platform.runLater(() -> {
    if (!editing && Files.exists(AppDirectory.dir().resolve(Project.getSuggestedFileName(model.title.get())))) {
      informationalAlert("String_Node_Str","String_Node_Str" + "String_Node_Str");
      return;
    }
    Main.instance.prefs.setContactAddress(model.email.get());
    AddProjectTypeWindow.open(model,editing);
  }
);
}
Program: 30964
Project: 30964
Buggy source:
/** 
 * Returns a human-readable email for the project. 
 */
public String getEmail(){
  return projectReq.getExtraDetails().getEmail();
}

Fixed version (ground truth):
/** 
 * Returns a human-readable email for the project or the empty string if missing. 
 */
public String getEmail(){
  return projectReq.getExtraDetails().getEmail();
}
Program: 30965
Project: 30965
Buggy source:
private void broadcastClaim(Set<LHProtos.Pledge> pledges,@Nullable KeyParameter key){
  try {
    PledgingWallet.CompletionProgress progress=Main.wallet.completeContractWithFee(projectToClaim,pledges,key);
    double total=Main.bitcoin.peerGroup().getMinBroadcastConnections() * 2;
    progress.peersSeen=seen -> {
      if (seen == -1) {
        Platform.runLater(onSuccess::run);
      }
 else {
        progressBar.setProgress(seen / total);
      }
    }
;
    progress.txFuture.handleAsync((t,ex) -> {
      if (ex != null) {
        informationalAlert("String_Node_Str","String_Node_Str",ex);
      }
 else {
        onSuccess.run();
      }
      overlayUI.done();
      return null;
    }
,Platform::runLater);
  }
 catch (  Ex.ValueMismatch e) {
    log.error("String_Node_Str" + e);
    informationalAlert("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",Coin.valueOf(e.byAmount).toFriendlyString());
    overlayUI.done();
  }
catch (  InsufficientMoneyException e) {
    log.error("String_Node_Str",e);
    informationalAlert("String_Node_Str","String_Node_Str" + "String_Node_Str");
    overlayUI.done();
  }
}

Fixed version (ground truth):
private void broadcastClaim(Set<LHProtos.Pledge> pledges,@Nullable KeyParameter key){
  try {
    PledgingWallet.CompletionProgress progress=Main.wallet.completeContractWithFee(projectToClaim,pledges,key);
    double total=Main.bitcoin.peerGroup().getMinBroadcastConnections();
    progress.peersSeen=seen -> {
      if (seen == -1) {
        Platform.runLater(onSuccess::run);
      }
 else {
        progressBar.setProgress(seen / total);
      }
    }
;
    progress.txFuture.handleAsync((t,ex) -> {
      if (ex != null) {
        informationalAlert("String_Node_Str","String_Node_Str",ex);
      }
 else {
        onSuccess.run();
      }
      overlayUI.done();
      return null;
    }
,Platform::runLater);
  }
 catch (  Ex.ValueMismatch e) {
    log.error("String_Node_Str" + e);
    informationalAlert("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",Coin.valueOf(e.byAmount).toFriendlyString());
    overlayUI.done();
  }
catch (  InsufficientMoneyException e) {
    log.error("String_Node_Str",e);
    informationalAlert("String_Node_Str","String_Node_Str" + "String_Node_Str");
    overlayUI.done();
  }
}
Program: 30966
Project: 30966
Buggy source:
private void diskPledgesChanged(SetChangeListener.Change<? extends LHProtos.Pledge> change,Project project){
  executor.checkOnThread();
  if (change.wasRemoved()) {
    LHProtos.Pledge walletPledge=wallet.getPledgeFor(project);
    LHProtos.Pledge removedPledge=change.getElementRemoved();
    if (walletPledge != null && walletPledge.equals(removedPledge)) {
      log.info("String_Node_Str");
    }
 else {
      log.info("String_Node_Str");
      openPledges.get(project).remove(removedPledge);
      getClaimedPledgesFor(project).remove(removedPledge);
      if (checkStatuses.get(project).error != null)       checkPledgesAgainstP2PNetwork(project,openPledges.get(project));
    }
  }
  if (change.wasAdded()) {
    final LHProtos.Pledge added=change.getElementAdded();
    if (isPledgeKnown(added)) {
      log.info("String_Node_Str",LHUtils.hashFromPledge(added));
    }
 else {
      log.info("String_Node_Str",project);
      jitteredExecute(() -> checkPledgeAgainstP2PNetwork(project,added),TX_PROPAGATION_TIME_SECS);
    }
  }
}

Fixed version (ground truth):
private void diskPledgesChanged(SetChangeListener.Change<? extends LHProtos.Pledge> change,Project project){
  executor.checkOnThread();
  if (change.wasRemoved()) {
    LHProtos.Pledge walletPledge=wallet.getPledgeFor(project);
    LHProtos.Pledge removedPledge=change.getElementRemoved();
    if (walletPledge != null && walletPledge.equals(removedPledge)) {
      log.info("String_Node_Str");
    }
 else {
      log.info("String_Node_Str");
      openPledges.get(project).remove(removedPledge);
      getClaimedPledgesFor(project).remove(removedPledge);
      CheckStatus status=checkStatuses.get(project);
      if (status != null && status.error != null)       checkPledgesAgainstP2PNetwork(project,openPledges.get(project));
    }
  }
  if (change.wasAdded()) {
    final LHProtos.Pledge added=change.getElementAdded();
    if (isPledgeKnown(added)) {
      log.info("String_Node_Str",LHUtils.hashFromPledge(added));
    }
 else {
      log.info("String_Node_Str",project);
      jitteredExecute(() -> checkPledgeAgainstP2PNetwork(project,added),TX_PROPAGATION_TIME_SECS);
    }
  }
}
Program: 30967
Project: 30967
Buggy source:
@FXML public void imageSelectorClicked(MouseEvent event){
  log.info("String_Node_Str");
  FileChooser chooser=new FileChooser();
  chooser.setTitle("String_Node_Str");
  chooser.getExtensionFilters().setAll(new FileChooser.ExtensionFilter("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  platformFiddleChooser(chooser);
  File result=chooser.showOpenDialog(Main.instance.mainStage);
  if (result == null)   return;
  setImageTo(unchecked(() -> result.toURI().toURL()));
}

Fixed version (ground truth):
@FXML public void imageSelectorClicked(MouseEvent event){
  log.info("String_Node_Str");
  FileChooser chooser=new FileChooser();
  chooser.setTitle("String_Node_Str");
  chooser.getExtensionFilters().setAll(new FileChooser.ExtensionFilter("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  platformFiddleChooser(chooser);
  Path prevPath=Main.instance.prefs.getCoverPhotoFolder();
  if (prevPath != null)   chooser.setInitialDirectory(prevPath.toFile());
  File result=chooser.showOpenDialog(Main.instance.mainStage);
  if (result == null)   return;
  Main.instance.prefs.setCoverPhotoFolder(result.toPath().getParent());
  setImageTo(unchecked(() -> result.toURI().toURL()));
}
Program: 30971
Project: 30971
Buggy source:
@Override public void start(Stage stage) throws Exception {
  Thread.currentThread().setContextClassLoader(Main.class.getClassLoader());
  instance=this;
  Project.GET_STATUS_USER_AGENT=APP_NAME + "String_Node_Str" + VERSION;
  AppDirectory.initAppDir(APP_NAME);
  unadjustedAppDir=AppDirectory.dir();
  List<Path> filesToOpen=new ArrayList<>();
  if (!parseCommandLineArgs() || FileOpenRequests.requestFileOpen(getParameters(),filesToOpen)) {
    Platform.exit();
    return;
  }
  setupLogging();
  log.info("String_Node_Str",APP_NAME,VERSION,LHUtils.nowAsString());
  log.info("String_Node_Str",AppDirectory.dir(),Runtime.getRuntime().availableProcessors());
  log.info("String_Node_Str",String.join("String_Node_Str",getParameters().getRaw()));
  CrashFX.setup();
  reached("String_Node_Str");
  prefs=new UserPrefs();
  initGUI(stage);
  stage.show();
  Runnable setup=() -> {
    uncheck(() -> initBitcoin(null));
    loadMainWindow();
    if (isMac()) {
      FileOpenRequests.handleMacFileOpenRequests();
    }
 else {
      for (      Path path : filesToOpen) {
        Platform.runLater(() -> {
          Main.instance.mainWindow.handleOpenedFile(path.toFile());
        }
);
      }
    }
  }
;
  runOnGuiThreadAfter(300,setup);
}

Fixed version (ground truth):
@Override public void start(Stage stage) throws Exception {
  Thread.currentThread().setContextClassLoader(Main.class.getClassLoader());
  instance=this;
  Project.GET_STATUS_USER_AGENT=APP_NAME + "String_Node_Str" + VERSION;
  AppDirectory.initAppDir(APP_NAME);
  unadjustedAppDir=AppDirectory.dir();
  List<Path> filesToOpen=new ArrayList<>();
  if (!parseCommandLineArgs() || FileOpenRequests.requestFileOpen(getParameters(),filesToOpen)) {
    Platform.exit();
    return;
  }
  setupLogging();
  log.info("String_Node_Str",APP_NAME,VERSION,LHUtils.nowAsString());
  log.info("String_Node_Str",AppDirectory.dir(),Runtime.getRuntime().availableProcessors());
  log.info("String_Node_Str",String.join("String_Node_Str",getParameters().getRaw()));
  CrashFX.setup();
  reached("String_Node_Str");
  prefs=new UserPrefs();
  initGUI(stage);
  stage.show();
  Runnable setup=() -> {
    uncheck(() -> initBitcoin(null));
    loadMainWindow();
    if (isMac()) {
      FileOpenRequests.handleMacFileOpenRequests();
    }
 else {
      for (      Path path : filesToOpen) {
        Platform.runLater(() -> {
          Main.instance.mainWindow.handleOpenedFile(path.toFile());
        }
);
      }
    }
    runOnGuiThreadAfter(500,WalletSetPasswordController::estimateKeyDerivationTime);
  }
;
  runOnGuiThreadAfter(300,setup);
}
Program: 30972
Project: 30972
Buggy source:
@FXML void confirmClicked(ActionEvent event){
  String password=pass1.getText();
  if (password.isEmpty() || password.length() < 4) {
    informationalAlert("String_Node_Str","String_Node_Str");
    return;
  }
  final KeyCrypterScrypt keyCrypter=(KeyCrypterScrypt)Main.bitcoin.wallet().getKeyCrypter();
  checkNotNull(keyCrypter);
  KeyDerivationTasks tasks=new KeyDerivationTasks(keyCrypter,password,getTargetTime()){
    @Override protected void onFinish(    KeyParameter aesKey){
      super.onFinish(aesKey);
      checkGuiThread();
      if (Main.bitcoin.wallet().checkAESKey(aesKey)) {
        WalletPasswordController.this.aesKey.set(aesKey);
      }
 else {
        log.warn("String_Node_Str");
        fadeOut(progressMeter);
        fadeIn(widgetBox);
        fadeIn(buttonsBox);
        informationalAlert("String_Node_Str","String_Node_Str");
      }
    }
  }
;
  progressMeter.progressProperty().bind(tasks.progress);
  tasks.start();
  fadeIn(progressMeter);
  fadeOut(widgetBox);
  fadeOut(buttonsBox);
}

Fixed version (ground truth):
@FXML void confirmClicked(ActionEvent event){
  String password=pass1.getText();
  if (password.isEmpty() || password.length() < 4) {
    informationalAlert("String_Node_Str","String_Node_Str");
    return;
  }
  final KeyCrypterScrypt keyCrypter=(KeyCrypterScrypt)Main.bitcoin.wallet().getKeyCrypter();
  checkNotNull(keyCrypter);
  KeyDerivationTasks tasks=new KeyDerivationTasks(keyCrypter,password,getTargetTime()){
    @Override protected void onFinish(    KeyParameter aesKey,    int timeTakenMsec){
      checkGuiThread();
      if (Main.bitcoin.wallet().checkAESKey(aesKey)) {
        WalletPasswordController.this.aesKey.set(aesKey);
      }
 else {
        log.warn("String_Node_Str");
        fadeOut(progressMeter);
        fadeIn(widgetBox);
        fadeIn(buttonsBox);
        informationalAlert("String_Node_Str","String_Node_Str");
      }
    }
  }
;
  progressMeter.progressProperty().bind(tasks.progress);
  tasks.start();
  fadeIn(progressMeter);
  fadeOut(widgetBox);
  fadeOut(buttonsBox);
}
Program: 30973
Project: 30973
Buggy source:
@Override protected void onFinish(KeyParameter aesKey){
  super.onFinish(aesKey);
  checkGuiThread();
  if (Main.bitcoin.wallet().checkAESKey(aesKey)) {
    WalletPasswordController.this.aesKey.set(aesKey);
  }
 else {
    log.warn("String_Node_Str");
    fadeOut(progressMeter);
    fadeIn(widgetBox);
    fadeIn(buttonsBox);
    informationalAlert("String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
@Override protected void onFinish(KeyParameter aesKey,int timeTakenMsec){
  checkGuiThread();
  if (Main.bitcoin.wallet().checkAESKey(aesKey)) {
    WalletPasswordController.this.aesKey.set(aesKey);
  }
 else {
    log.warn("String_Node_Str");
    fadeOut(progressMeter);
    fadeIn(widgetBox);
    fadeIn(buttonsBox);
    informationalAlert("String_Node_Str","String_Node_Str");
  }
}
Program: 30974
Project: 30974
Buggy source:
@FXML public void setPasswordClicked(ActionEvent event){
  if (!pass1.getText().equals(pass2.getText())) {
    informationalAlert("String_Node_Str","String_Node_Str");
    return;
  }
  String password=pass1.getText();
  if (password.length() < 4) {
    informationalAlert("String_Node_Str","String_Node_Str");
    return;
  }
  fadeIn(progressMeter);
  fadeOut(widgetGrid);
  fadeOut(explanationLabel);
  fadeOut(buttonHBox);
  log.info("String_Node_Str");
  IdealPasswordParameters params=new IdealPasswordParameters(password);
  KeyCrypterScrypt scrypt=new KeyCrypterScrypt(params.realIterations);
  WalletPasswordController.setTargetTime(params.realTargetTime);
  KeyDerivationTasks tasks=new KeyDerivationTasks(scrypt,password,params.realTargetTime){
    @Override protected void onFinish(    KeyParameter aesKey){
      Main.bitcoin.wallet().encrypt(scrypt,aesKey);
      informationalAlert("String_Node_Str","String_Node_Str");
      overlayUI.done();
    }
  }
;
  progressMeter.progressProperty().bind(tasks.progress);
  tasks.start();
}

Fixed version (ground truth):
@FXML public void setPasswordClicked(ActionEvent event){
  if (!pass1.getText().equals(pass2.getText())) {
    informationalAlert("String_Node_Str","String_Node_Str");
    return;
  }
  String password=pass1.getText();
  if (password.length() < 4) {
    informationalAlert("String_Node_Str","String_Node_Str");
    return;
  }
  fadeIn(progressMeter);
  fadeOut(widgetGrid);
  fadeOut(explanationLabel);
  fadeOut(buttonHBox);
  KeyCrypterScrypt scrypt=new KeyCrypterScrypt(SCRYPT_PARAMETERS);
  KeyDerivationTasks tasks=new KeyDerivationTasks(scrypt,password,estimatedKeyDerivationTime){
    @Override protected void onFinish(    KeyParameter aesKey,    int timeTakenMsec){
      WalletPasswordController.setTargetTime(Duration.ofMillis(timeTakenMsec));
      log.info("String_Node_Str");
      Main.bitcoin.wallet().encrypt(scrypt,aesKey);
      log.info("String_Node_Str");
      informationalAlert("String_Node_Str","String_Node_Str");
      overlayUI.done();
    }
  }
;
  progressMeter.progressProperty().bind(tasks.progress);
  tasks.start();
}
Program: 30975
Project: 30975
Buggy source:
@Override protected void onFinish(KeyParameter aesKey){
  Main.bitcoin.wallet().encrypt(scrypt,aesKey);
  informationalAlert("String_Node_Str","String_Node_Str");
  overlayUI.done();
}

Fixed version (ground truth):
@Override protected void onFinish(KeyParameter aesKey,int timeTakenMsec){
  WalletPasswordController.setTargetTime(Duration.ofMillis(timeTakenMsec));
  log.info("String_Node_Str");
  Main.bitcoin.wallet().encrypt(scrypt,aesKey);
  log.info("String_Node_Str");
  informationalAlert("String_Node_Str","String_Node_Str");
  overlayUI.done();
}
Program: 30976
Project: 30976
Buggy source:
@Override protected Void call() throws Exception {
  long startTime=System.currentTimeMillis();
  long curTime;
  long targetTimeMillis=targetTime.toMillis();
  while ((curTime=System.currentTimeMillis()) < startTime + targetTimeMillis) {
    double progress=(curTime - startTime) / (double)targetTimeMillis;
    updateProgress(progress,1.0);
    Uninterruptibles.sleepUninterruptibly(20,TimeUnit.MILLISECONDS);
  }
  updateProgress(1.0,1.0);
  aesKey=keyDerivationTask.get();
  return null;
}

Fixed version (ground truth):
@Override protected Void call() throws Exception {
  if (targetTime != null) {
    long startTime=System.currentTimeMillis();
    long curTime;
    long targetTimeMillis=targetTime.toMillis();
    while ((curTime=System.currentTimeMillis()) < startTime + targetTimeMillis) {
      double progress=(curTime - startTime) / (double)targetTimeMillis;
      updateProgress(progress,1.0);
      Uninterruptibles.sleepUninterruptibly(20,TimeUnit.MILLISECONDS);
    }
    updateProgress(1.0,1.0);
  }
 else {
    updateProgress(-1,-1);
  }
  aesKey=keyDerivationTask.get();
  return null;
}
Program: 30977
Project: 30977
Buggy source:
public KeyDerivationTasks(KeyCrypterScrypt scrypt,String password,Duration targetTime){
  keyDerivationTask=new Task<KeyParameter>(){
    @Override protected KeyParameter call() throws Exception {
      try {
        return scrypt.deriveKey(password);
      }
 catch (      Throwable e) {
        e.printStackTrace();
        throw e;
      }
 finally {
        log.info("String_Node_Str");
      }
    }
  }
;
  progressTask=new Task<Void>(){
    private KeyParameter aesKey;
    @Override protected Void call() throws Exception {
      long startTime=System.currentTimeMillis();
      long curTime;
      long targetTimeMillis=targetTime.toMillis();
      while ((curTime=System.currentTimeMillis()) < startTime + targetTimeMillis) {
        double progress=(curTime - startTime) / (double)targetTimeMillis;
        updateProgress(progress,1.0);
        Uninterruptibles.sleepUninterruptibly(20,TimeUnit.MILLISECONDS);
      }
      updateProgress(1.0,1.0);
      aesKey=keyDerivationTask.get();
      return null;
    }
    @Override protected void succeeded(){
      checkGuiThread();
      onFinish(aesKey);
    }
  }
;
  progress=progressTask.progressProperty();
}

Fixed version (ground truth):
public KeyDerivationTasks(KeyCrypterScrypt scrypt,String password,@Nullable Duration targetTime){
  keyDerivationTask=new Task<KeyParameter>(){
    @Override protected KeyParameter call() throws Exception {
      long start=System.currentTimeMillis();
      try {
        log.info("String_Node_Str");
        KeyParameter result=scrypt.deriveKey(password);
        timeTakenMsec=(int)(System.currentTimeMillis() - start);
        log.info("String_Node_Str",timeTakenMsec);
        return result;
      }
 catch (      Throwable e) {
        log.error("String_Node_Str",e);
        throw e;
      }
    }
  }
;
  progressTask=new Task<Void>(){
    private KeyParameter aesKey;
    @Override protected Void call() throws Exception {
      if (targetTime != null) {
        long startTime=System.currentTimeMillis();
        long curTime;
        long targetTimeMillis=targetTime.toMillis();
        while ((curTime=System.currentTimeMillis()) < startTime + targetTimeMillis) {
          double progress=(curTime - startTime) / (double)targetTimeMillis;
          updateProgress(progress,1.0);
          Uninterruptibles.sleepUninterruptibly(20,TimeUnit.MILLISECONDS);
        }
        updateProgress(1.0,1.0);
      }
 else {
        updateProgress(-1,-1);
      }
      aesKey=keyDerivationTask.get();
      return null;
    }
    @Override protected void succeeded(){
      checkGuiThread();
      onFinish(aesKey,timeTakenMsec);
    }
  }
;
  progress=progressTask.progressProperty();
}
Program: 30978
Project: 30978
Buggy source:
protected void onFinish(KeyParameter aesKey){
}

Fixed version (ground truth):
protected void onFinish(KeyParameter aesKey,int timeTakenMsec){
}
Program: 30979
Project: 30979
Buggy source:
@Override protected void succeeded(){
  checkGuiThread();
  onFinish(aesKey);
}

Fixed version (ground truth):
@Override protected void succeeded(){
  checkGuiThread();
  onFinish(aesKey,timeTakenMsec);
}