nus-yam/ex-repair huggingface dataset:
Program: 91180
Project: 91180
Buggy source:
public static Bip38PrivateKey parseBip38PrivateKey(String bip38PrivateKey){
  byte[] decoded=Base58.decodeChecked(bip38PrivateKey);
  if (decoded == null) {
    return null;
  }
  if (decoded.length != 39) {
    return null;
  }
  int index=0;
  if (decoded[index++] != (byte)0x01) {
    return null;
  }
  boolean ecMultiply;
  if (decoded[index] == (byte)0x42) {
    ecMultiply=false;
  }
 else   if (decoded[index] == (byte)0x43) {
    ecMultiply=true;
  }
 else {
    return null;
  }
  index++;
  int flags=((int)decoded[index++]) & 0x00ff;
  boolean lotSequence;
  if (ecMultiply) {
    if ((flags | 0x0024) != 0x24) {
      return null;
    }
    lotSequence=(flags & 0x0004) == 0 ? false : true;
  }
 else {
    if ((flags | 0x00E0) != 0xE0) {
      return null;
    }
    if ((flags & 0x00c0) != 0x00c0) {
      return null;
    }
    lotSequence=false;
  }
  boolean compressed=(flags & 0x0020) == 0 ? false : true;
  byte[] salt=new byte[4];
  salt[0]=decoded[index++];
  salt[1]=decoded[index++];
  salt[2]=decoded[index++];
  salt[3]=decoded[index++];
  byte[] data=new byte[32];
  System.arraycopy(decoded,index,data,0,data.length);
  index+=data.length;
  return new Bip38PrivateKey(ecMultiply,compressed,lotSequence,salt,data);
}

Fixed version (ground truth):
public static Bip38PrivateKey parseBip38PrivateKey(String bip38PrivateKey){
  byte[] decoded=Base58.decodeChecked(bip38PrivateKey);
  if (decoded == null) {
    return null;
  }
  if (decoded.length != 39) {
    return null;
  }
  int index=0;
  if (decoded[index++] != (byte)0x01) {
    return null;
  }
  boolean ecMultiply;
  if (decoded[index] == (byte)0x42) {
    ecMultiply=false;
  }
 else   if (decoded[index] == (byte)0x43) {
    ecMultiply=true;
  }
 else {
    return null;
  }
  index++;
  int flags=((int)decoded[index++]) & 0x00ff;
  boolean lotSequence;
  if (ecMultiply) {
    if ((flags | 0x0024) != 0x24) {
      return null;
    }
    lotSequence=(flags & 0x0004) != 0;
  }
 else {
    if ((flags | 0x00E0) != 0xE0) {
      return null;
    }
    if ((flags & 0x00c0) != 0x00c0) {
      return null;
    }
    lotSequence=false;
  }
  boolean compressed=(flags & 0x0020) != 0;
  byte[] salt=new byte[4];
  System.arraycopy(decoded,index,salt,0,salt.length);
  index+=salt.length;
  byte[] data=new byte[32];
  System.arraycopy(decoded,index,data,0,data.length);
  return new Bip38PrivateKey(ecMultiply,compressed,lotSequence,salt,data);
}
Program: 91181
Project: 91181
Buggy source:
/** 
 * Perform BIP38 compatible password stretching on a password to derive the BIP38 key material
 * @throws InterruptedException
 */
public static byte[] bip38Stretch1(String passphrase,byte[] salt,SCryptProgress progressTracker,int outputSize) throws InterruptedException {
  byte[] derived;
  try {
    derived=SCrypt.scrypt(passphrase.getBytes("String_Node_Str"),salt,SCRYPT_N,SCRYPT_R,SCRYPT_P,outputSize,progressTracker);
    return derived;
  }
 catch (  UnsupportedEncodingException e) {
    throw new RuntimeException(e);
  }
catch (  GeneralSecurityException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Perform BIP38 compatible password stretching on a password to derive the BIP38 key material
 */
public static byte[] bip38Stretch1(String passphrase,byte[] salt,SCryptProgress progressTracker,int outputSize) throws InterruptedException {
  byte[] derived;
  String normalizedPassphrase=Normalizer.normalize(passphrase,Normalizer.Form.NFC);
  try {
    derived=SCrypt.scrypt(normalizedPassphrase.getBytes("String_Node_Str"),salt,SCRYPT_N,SCRYPT_R,SCRYPT_P,outputSize,progressTracker);
    return derived;
  }
 catch (  UnsupportedEncodingException|GeneralSecurityException e) {
    throw new RuntimeException(e);
  }
}
Program: 91182
Project: 91182
Buggy source:
public static String decryptNoEcMultiply(Bip38PrivateKey bip38Key,byte[] stretcedKeyMaterial,NetworkParameters network){
  byte[] derivedHalf1=new byte[32];
  System.arraycopy(stretcedKeyMaterial,0,derivedHalf1,0,32);
  byte[] derivedHalf2=new byte[32];
  System.arraycopy(stretcedKeyMaterial,32,derivedHalf2,0,32);
  Rijndael aes=new Rijndael();
  aes.makeKey(derivedHalf2,256);
  byte[] encryptedHalf1=new byte[16];
  System.arraycopy(bip38Key.data,0,encryptedHalf1,0,encryptedHalf1.length);
  byte[] encryptedHalf2=new byte[16];
  System.arraycopy(bip38Key.data,16,encryptedHalf2,0,encryptedHalf2.length);
  byte[] decryptedHalf1=new byte[16];
  aes.decrypt(encryptedHalf1,decryptedHalf1);
  byte[] decryptedHalf2=new byte[16];
  aes.decrypt(encryptedHalf2,decryptedHalf2);
  byte[] complete=new byte[32];
  for (int i=0; i < 16; i++) {
    complete[i]=(byte)((((int)decryptedHalf1[i]) & 0xFF) ^ (((int)derivedHalf1[i]) & 0xFF));
    complete[i + 16]=(byte)((((int)decryptedHalf2[i]) & 0xFF) ^ (((int)derivedHalf1[i + 16]) & 0xFF));
  }
  InMemoryPrivateKey key=new InMemoryPrivateKey(complete,bip38Key.compressed);
  Address address=key.getPublicKey().toAddress(network);
  byte[] newSalt=calculateScryptSalt(address);
  if (!BitUtils.areEqual(bip38Key.salt,newSalt)) {
    return null;
  }
  String result=key.getBase58EncodedPrivateKey(network);
  return result;
}

Fixed version (ground truth):
public static String decryptNoEcMultiply(Bip38PrivateKey bip38Key,byte[] stretcedKeyMaterial,NetworkParameters network){
  byte[] derivedHalf1=new byte[32];
  System.arraycopy(stretcedKeyMaterial,0,derivedHalf1,0,32);
  byte[] derivedHalf2=new byte[32];
  System.arraycopy(stretcedKeyMaterial,32,derivedHalf2,0,32);
  Rijndael aes=new Rijndael();
  aes.makeKey(derivedHalf2,256);
  byte[] encryptedHalf1=new byte[16];
  System.arraycopy(bip38Key.data,0,encryptedHalf1,0,encryptedHalf1.length);
  byte[] encryptedHalf2=new byte[16];
  System.arraycopy(bip38Key.data,16,encryptedHalf2,0,encryptedHalf2.length);
  byte[] decryptedHalf1=new byte[16];
  aes.decrypt(encryptedHalf1,decryptedHalf1);
  byte[] decryptedHalf2=new byte[16];
  aes.decrypt(encryptedHalf2,decryptedHalf2);
  byte[] complete=new byte[32];
  for (int i=0; i < 16; i++) {
    complete[i]=(byte)((((int)decryptedHalf1[i]) & 0xFF) ^ (((int)derivedHalf1[i]) & 0xFF));
    complete[i + 16]=(byte)((((int)decryptedHalf2[i]) & 0xFF) ^ (((int)derivedHalf1[i + 16]) & 0xFF));
  }
  InMemoryPrivateKey key=new InMemoryPrivateKey(complete,bip38Key.compressed);
  Address address=key.getPublicKey().toAddress(network);
  byte[] newSalt=calculateScryptSalt(address);
  if (!BitUtils.areEqual(bip38Key.salt,newSalt)) {
    return null;
  }
  return key.getBase58EncodedPrivateKey(network);
}
Program: 91183
Project: 91183
Buggy source:
private boolean checkIsRMCICOPaymentRequest(){
  return new RmcApiClient(_mbwManager.getNetwork()).isCallbackMine(_bitcoinUri.callbackURL);
}

Fixed version (ground truth):
private boolean checkIsRMCICOPaymentRequest(){
  return _bitcoinUri != null && _bitcoinUri.callbackURL != null && new RmcApiClient(_mbwManager.getNetwork()).isCallbackMine(_bitcoinUri.callbackURL);
}
Program: 91184
Project: 91184
Buggy source:
private void verify(InMemoryPrivateKey pk){
  Address address=pk.getPublicKey().toAddress(_mbwManager.getNetwork());
  UUID account=SingleAddressAccount.calculateId(address);
  boolean success=_mbwManager.getWalletManager(false).hasAccount(account) || _mbwManager.getColuManager().hasAccount(account);
  for (  ColuAccount.ColuAsset coluAsset : ColuAccount.ColuAsset.getAssetMap(_mbwManager.getColuManager().getNetwork()).values()) {
    UUID coluUUID=ColuAccount.getGuidForAsset(coluAsset,pk.getPublicKey().getPublicKeyBytes());
    success|=_mbwManager.getColuManager().hasAccount(coluUUID);
  }
  if (success) {
    _mbwManager.getMetadataStorage().setOtherAccountBackupState(account,MetadataStorage.BackupState.VERIFIED);
    for (    ColuAccount.ColuAsset coluAsset : ColuAccount.ColuAsset.getAssetMap(_mbwManager.getColuManager().getNetwork()).values()) {
      UUID coluUUID=ColuAccount.getGuidForAsset(coluAsset,pk.getPublicKey().getPublicKeyBytes());
      _mbwManager.getMetadataStorage().setOtherAccountBackupState(coluUUID,MetadataStorage.BackupState.VERIFIED);
    }
    updateUi();
    String message=getResources().getString(R.string.verify_backup_ok,address.toMultiLineString());
    ShowDialogMessage(message,false);
  }
 else {
    ShowDialogMessage(R.string.verify_backup_no_such_record,false);
  }
}

Fixed version (ground truth):
private void verify(InMemoryPrivateKey pk){
  Address address=pk.getPublicKey().toAddress(_mbwManager.getNetwork());
  UUID account=SingleAddressAccount.calculateId(address);
  boolean success=_mbwManager.getWalletManager(false).hasAccount(account) || _mbwManager.getColuManager().hasAccount(account);
  for (  ColuAccount.ColuAsset coluAsset : ColuAccount.ColuAsset.getAssetMap(_mbwManager.getColuManager().getNetwork()).values()) {
    UUID coluUUID=ColuAccount.getGuidForAsset(coluAsset,pk.getPublicKey().toAddress(_mbwManager.getNetwork()).getAllAddressBytes());
    success|=_mbwManager.getColuManager().hasAccount(coluUUID);
  }
  if (success) {
    _mbwManager.getMetadataStorage().setOtherAccountBackupState(account,MetadataStorage.BackupState.VERIFIED);
    for (    ColuAccount.ColuAsset coluAsset : ColuAccount.ColuAsset.getAssetMap(_mbwManager.getColuManager().getNetwork()).values()) {
      UUID coluUUID=ColuAccount.getGuidForAsset(coluAsset,pk.getPublicKey().toAddress(_mbwManager.getNetwork()).getAllAddressBytes());
      _mbwManager.getMetadataStorage().setOtherAccountBackupState(coluUUID,MetadataStorage.BackupState.VERIFIED);
    }
    updateUi();
    String message=getResources().getString(R.string.verify_backup_ok,address.toMultiLineString());
    ShowDialogMessage(message,false);
  }
 else {
    ShowDialogMessage(R.string.verify_backup_no_such_record,false);
  }
}
Program: 91185
Project: 91185
Buggy source:
public static UUID getGuidForAsset(ColuAsset coluAsset,byte[] publicKeyBytes){
  ByteWriter byteWriter=new ByteWriter(36);
  byteWriter.putBytes(publicKeyBytes);
  byteWriter.putRawStringUtf8(coluAsset.id);
  Sha256Hash accountId=HashUtils.sha256(byteWriter.toBytes());
  return getGuidFromByteArray(accountId.getBytes());
}

Fixed version (ground truth):
public static UUID getGuidForAsset(ColuAsset coluAsset,byte[] addressBytes){
  ByteWriter byteWriter=new ByteWriter(36);
  byteWriter.putBytes(addressBytes);
  byteWriter.putRawStringUtf8(coluAsset.id);
  Sha256Hash accountId=HashUtils.sha256(byteWriter.toBytes());
  return getGuidFromByteArray(accountId.getBytes());
}
Program: 91186
Project: 91186
Buggy source:
public UUID enableAsset(ColuAccount.ColuAsset coluAsset,InMemoryPrivateKey key){
  if (key != null && isAddressInUse(key.getPublicKey().toAddress(getNetwork())))   return null;
  if (key != null) {
    UUID uuid=ColuAccount.getGuidForAsset(coluAsset,key.getPublicKey().getPublicKeyBytes());
    if (coluAccounts.containsKey(uuid)) {
      return uuid;
    }
  }
  ColuAccount newAccount=createAccount(coluAsset,key);
  handler.post(new Runnable(){
    @Override public void run(){
      eventBus.post(new ExtraAccountsChanged());
    }
  }
);
  saveEnabledAssetIds();
  return newAccount.getId();
}

Fixed version (ground truth):
public UUID enableAsset(ColuAccount.ColuAsset coluAsset,InMemoryPrivateKey key){
  if (key != null && isAddressInUse(key.getPublicKey().toAddress(getNetwork())))   return null;
  if (key != null) {
    UUID uuid=ColuAccount.getGuidForAsset(coluAsset,key.getPublicKey().toAddress(getNetwork()).getAllAddressBytes());
    if (coluAccounts.containsKey(uuid)) {
      return uuid;
    }
  }
  ColuAccount newAccount=createAccount(coluAsset,key);
  handler.post(new Runnable(){
    @Override public void run(){
      eventBus.post(new ExtraAccountsChanged());
    }
  }
);
  saveEnabledAssetIds();
  return newAccount.getId();
}
Program: 91188
Project: 91188
Buggy source:
public void run(){
  try {
    List<QueryExchangeRatesResponse> responses=new ArrayList<QueryExchangeRatesResponse>();
    List<String> selectedCurrencies;
synchronized (_requestLock) {
      selectedCurrencies=new ArrayList<String>(_fiatCurrencies);
    }
    for (    String currency : selectedCurrencies) {
      responses.add(_api.queryExchangeRates(new QueryExchangeRatesRequest(Wapi.VERSION,currency)).getResult());
    }
synchronized (_requestLock) {
      setLatestRates(responses);
      _fetcher=null;
      notifyRefreshingExchangeRatesSucceeded();
    }
  }
 catch (  WapiException e) {
synchronized (_requestLock) {
      _fetcher=null;
      notifyRefreshingExchangeRatesFailed();
    }
  }
  if (rmcApiClient != null) {
    RmcApiClient rmcApiClient=new RmcApiClient(null);
    Float rate=rmcApiClient.exchangeUsdRmcRate();
    if (rate != null) {
      rmcRate=rate;
      getPreferences().edit().putFloat(USD_RMC,rmcRate).apply();
    }
    rate=rmcApiClient.exchangeEthUsdRate();
    if (rate != null) {
      ethRate=rate;
    }
  }
}

Fixed version (ground truth):
public void run(){
  try {
    List<QueryExchangeRatesResponse> responses=new ArrayList<QueryExchangeRatesResponse>();
    List<String> selectedCurrencies;
synchronized (_requestLock) {
      selectedCurrencies=new ArrayList<String>(_fiatCurrencies);
    }
    for (    String currency : selectedCurrencies) {
      responses.add(_api.queryExchangeRates(new QueryExchangeRatesRequest(Wapi.VERSION,currency)).getResult());
    }
synchronized (_requestLock) {
      setLatestRates(responses);
      _fetcher=null;
      notifyRefreshingExchangeRatesSucceeded();
    }
  }
 catch (  WapiException e) {
synchronized (_requestLock) {
      _fetcher=null;
      notifyRefreshingExchangeRatesFailed();
    }
  }
  if (rmcApiClient != null) {
    RmcApiClient rmcApiClient=new RmcApiClient(null);
    Float rate=rmcApiClient.exchangeUsdRmcRate();
    if (rate != null) {
      rmcRate=rate;
      getPreferences().edit().putFloat(USD_RMC,rmcRate).apply();
    }
    rate=rmcApiClient.exchangeEthUsdRate();
    if (rate != null) {
      ethRate=rate;
    }
    rate=rmcApiClient.exchangeBtcUsdRate();
    if (rate != null) {
      usdRate=rate;
    }
  }
}
Program: 91190
Project: 91190
Buggy source:
@Override public void onClick(DialogInterface dialogInterface,int i){
  UUID account;
  if (i == 0) {
    account=_mbwManager.getWalletManager(false).createSingleAddressAccount(address);
  }
 else {
    ColuAccount.ColuAsset coluAsset=ColuAccount.ColuAsset.getByType(ColuAccount.ColuAssetType.valueOf(list.get(selectedItem)),_mbwManager.getNetwork());
    account=_mbwManager.getColuManager().enableReadOnlyAsset(coluAsset,address);
  }
  finishOk(account);
}

Fixed version (ground truth):
@Override public void onClick(DialogInterface dialogInterface,int i){
  UUID account;
  if (selectedItem == 0) {
    account=_mbwManager.getWalletManager(false).createSingleAddressAccount(address);
  }
 else {
    ColuAccount.ColuAsset coluAsset=ColuAccount.ColuAsset.getByType(ColuAccount.ColuAssetType.valueOf(list.get(selectedItem)),_mbwManager.getNetwork());
    account=_mbwManager.getColuManager().enableReadOnlyAsset(coluAsset,address);
  }
  finishOk(account);
}
Program: 91191
Project: 91191
Buggy source:
@Override protected void onPostExecute(UUID account){
  dialog.dismiss();
  if (account != null) {
    finishOk(account);
  }
 else   if (askUserForColorize) {
    final List<String> list=ColuAccount.ColuAsset.getAllAssetNames(_mbwManager.getNetwork());
    list.add(0,"String_Node_Str");
    new AlertDialog.Builder(AddAdvancedAccountActivity.this).setTitle(R.string.restore_addres_as).setSingleChoiceItems(list.toArray(new String[list.size()]),0,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialogInterface,      int i){
        selectedItem=i;
      }
    }
).setPositiveButton(R.string.button_ok,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialogInterface,      int i){
        UUID account;
        if (i == 0) {
          account=_mbwManager.getWalletManager(false).createSingleAddressAccount(address);
        }
 else {
          ColuAccount.ColuAsset coluAsset=ColuAccount.ColuAsset.getByType(ColuAccount.ColuAssetType.valueOf(list.get(selectedItem)),_mbwManager.getNetwork());
          account=_mbwManager.getColuManager().enableReadOnlyAsset(coluAsset,address);
        }
        finishOk(account);
      }
    }
).create().show();
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(UUID account){
  dialog.dismiss();
  if (account != null) {
    finishOk(account);
  }
 else   if (askUserForColorize) {
    final List<String> list=ColuAccount.ColuAsset.getAllAssetNames(_mbwManager.getNetwork());
    list.add(0,"String_Node_Str");
    new AlertDialog.Builder(AddAdvancedAccountActivity.this).setTitle(R.string.restore_addres_as).setSingleChoiceItems(list.toArray(new String[list.size()]),0,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialogInterface,      int i){
        selectedItem=i;
      }
    }
).setPositiveButton(R.string.button_ok,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialogInterface,      int i){
        UUID account;
        if (selectedItem == 0) {
          account=_mbwManager.getWalletManager(false).createSingleAddressAccount(address);
        }
 else {
          ColuAccount.ColuAsset coluAsset=ColuAccount.ColuAsset.getByType(ColuAccount.ColuAssetType.valueOf(list.get(selectedItem)),_mbwManager.getNetwork());
          account=_mbwManager.getColuManager().enableReadOnlyAsset(coluAsset,address);
        }
        finishOk(account);
      }
    }
).create().show();
  }
}
Program: 91192
Project: 91192
Buggy source:
@Override public void onClick(DialogInterface dialogInterface,int i){
  UUID account;
  if (i == 0) {
    account=_mbwManager.getWalletManager(false).createSingleAddressAccount(address);
  }
 else {
    ColuAccount.ColuAsset coluAsset=ColuAccount.ColuAsset.getByType(ColuAccount.ColuAssetType.valueOf(list.get(selectedItem)),_mbwManager.getNetwork());
    account=_mbwManager.getColuManager().enableReadOnlyAsset(coluAsset,address);
  }
  finishOk(account);
}

Fixed version (ground truth):
@Override public void onClick(DialogInterface dialogInterface,int i){
  UUID account;
  if (selectedItem == 0) {
    account=_mbwManager.getWalletManager(false).createSingleAddressAccount(address);
  }
 else {
    ColuAccount.ColuAsset coluAsset=ColuAccount.ColuAsset.getByType(ColuAccount.ColuAssetType.valueOf(list.get(selectedItem)),_mbwManager.getNetwork());
    account=_mbwManager.getColuManager().enableReadOnlyAsset(coluAsset,address);
  }
  finishOk(account);
}
Program: 91193
Project: 91193
Buggy source:
@Override protected void onPostExecute(UUID account){
  dialog.dismiss();
  if (account != null) {
    finishOk(account);
  }
 else   if (askUserForColorize) {
    final List<String> list=ColuAccount.ColuAsset.getAllAssetNames(_mbwManager.getNetwork());
    list.add(0,"String_Node_Str");
    new AlertDialog.Builder(AddAdvancedAccountActivity.this).setTitle(R.string.restore_addres_as).setSingleChoiceItems(list.toArray(new String[list.size()]),0,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialogInterface,      int i){
        selectedItem=i;
      }
    }
).setPositiveButton(R.string.button_ok,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialogInterface,      int i){
        UUID account;
        if (i == 0) {
          account=_mbwManager.getWalletManager(false).createSingleAddressAccount(address);
        }
 else {
          ColuAccount.ColuAsset coluAsset=ColuAccount.ColuAsset.getByType(ColuAccount.ColuAssetType.valueOf(list.get(selectedItem)),_mbwManager.getNetwork());
          account=_mbwManager.getColuManager().enableReadOnlyAsset(coluAsset,address);
        }
        finishOk(account);
      }
    }
).create().show();
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(UUID account){
  dialog.dismiss();
  if (account != null) {
    finishOk(account);
  }
 else   if (askUserForColorize) {
    final List<String> list=ColuAccount.ColuAsset.getAllAssetNames(_mbwManager.getNetwork());
    list.add(0,"String_Node_Str");
    new AlertDialog.Builder(AddAdvancedAccountActivity.this).setTitle(R.string.restore_addres_as).setSingleChoiceItems(list.toArray(new String[list.size()]),0,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialogInterface,      int i){
        selectedItem=i;
      }
    }
).setPositiveButton(R.string.button_ok,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialogInterface,      int i){
        UUID account;
        if (selectedItem == 0) {
          account=_mbwManager.getWalletManager(false).createSingleAddressAccount(address);
        }
 else {
          ColuAccount.ColuAsset coluAsset=ColuAccount.ColuAsset.getByType(ColuAccount.ColuAssetType.valueOf(list.get(selectedItem)),_mbwManager.getNetwork());
          account=_mbwManager.getColuManager().enableReadOnlyAsset(coluAsset,address);
        }
        finishOk(account);
      }
    }
).create().show();
  }
}
Program: 91194
Project: 91194
Buggy source:
@Override public void itemClick(final PartnerInfo bean){
  if (bean.getInfo() != null && bean.getInfo().length() > 0) {
    View custom=LayoutInflater.from(getActivity()).inflate(R.layout.main_recommendation_dialog_view,null,false);
    TextView part1=(TextView)custom.findViewById(R.id.part1);
    int pointIndex=bean.getInfo().indexOf("String_Node_Str") + 1;
    part1.setText(bean.getInfo().substring(0,pointIndex));
    TextView part2=(TextView)custom.findViewById(R.id.part2);
    part2.setText(bean.getInfo().substring(pointIndex));
    ((ImageView)custom.findViewById(R.id.image)).setImageResource(bean.getIcon());
    AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
    builder.setTitle(warning_partner);
    builder.setView(custom);
    builder.setPositiveButton(ok,new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int id){
        if (bean.getUri() != null) {
          Intent intent=new Intent(Intent.ACTION_VIEW);
          intent.setData(Uri.parse(bean.getUri()));
          startActivity(intent);
        }
      }
    }
);
    builder.setNegativeButton(cancel,null);
    AlertDialog dialog=builder.create();
    dialog.show();
  }
 else {
    if (bean.getUri() != null) {
      Intent i=new Intent(Intent.ACTION_VIEW);
      i.setData(Uri.parse(bean.getUri()));
      startActivity(i);
    }
  }
}

Fixed version (ground truth):
@Override public void itemClick(final PartnerInfo bean){
  if (bean.getInfo() != null && bean.getInfo().length() > 0) {
    View custom=LayoutInflater.from(getActivity()).inflate(R.layout.main_recommendation_dialog_view,null,false);
    TextView part1=(TextView)custom.findViewById(R.id.part1);
    int pointIndex=bean.getInfo().indexOf("String_Node_Str") + 1;
    part1.setText(bean.getInfo().substring(0,pointIndex));
    TextView part2=(TextView)custom.findViewById(R.id.part2);
    part2.setText(bean.getInfo().substring(pointIndex));
    ((ImageView)custom.findViewById(R.id.image)).setImageResource(bean.getIcon());
    AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
    builder.setTitle(warning_partner);
    builder.setView(custom);
    builder.setPositiveButton(ok,new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int id){
        if (bean.getUri() != null) {
          Intent intent=new Intent(Intent.ACTION_VIEW);
          intent.setData(Uri.parse(bean.getUri()));
          startActivity(intent);
        }
      }
    }
);
    builder.setNegativeButton(cancel,null);
    alertDialog=builder.create();
    alertDialog.show();
  }
 else {
    if (bean.getUri() != null) {
      Intent i=new Intent(Intent.ACTION_VIEW);
      i.setData(Uri.parse(bean.getUri()));
      startActivity(i);
    }
  }
}
Program: 91197
Project: 91197
Buggy source:
public SignatureTestVector(String pk,String message,String signatureDer) throws UnsupportedEncodingException {
  final Signature signature=Signatures.decodeSignatureParameters(new ByteReader(HexUtils.toBytes(signatureDer)));
  this.pk=new InMemoryPrivateKey(HexUtils.toBytes(pk),true);
  this.message=message.getBytes("String_Node_Str");
  this.r=signature.r;
  this.s=signature.s;
}

Fixed version (ground truth):
SignatureTestVector(String pk,String message,String signatureDer) throws UnsupportedEncodingException {
  final Signature signature=Signatures.decodeSignatureParameters(new ByteReader(HexUtils.toBytes(signatureDer)));
  this.pk=new InMemoryPrivateKey(HexUtils.toBytes(pk),true);
  this.message=message.getBytes("String_Node_Str");
  this.r=signature.r;
  this.s=signature.s;
}
Program: 91198
Project: 91198
Buggy source:
/** 
 * Check if the signatures are RFC6979 compliant, by using various test vectors
 */
@Test public void checkDeterministicSig() throws UnsupportedEncodingException {
  new SignatureTestVector("String_Node_Str","String_Node_Str","String_Node_Str").check();
  new SignatureTestVector("String_Node_Str","String_Node_Str","String_Node_Str").check();
  new SignatureTestVector("String_Node_Str","String_Node_Str","String_Node_Str").check();
  new SignatureTestVector("String_Node_Str","String_Node_Str","String_Node_Str").check();
  new SignatureTestVector("String_Node_Str","String_Node_Str","String_Node_Str").check();
  new SignatureTestVector("String_Node_Str","String_Node_Str","String_Node_Str").check();
  new SignatureTestVector("String_Node_Str","String_Node_Str","String_Node_Str").check();
  new SignatureTestVector("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str").check();
}

Fixed version (ground truth):
/** 
 * Check if the signatures are RFC6979 compliant, by using various test vectors
 */
@Test public void checkDeterministicSig() throws UnsupportedEncodingException {
  for (  SignatureTestVector stv : new SignatureTestVector[]{new SignatureTestVector("String_Node_Str","String_Node_Str","String_Node_Str"),new SignatureTestVector("String_Node_Str","String_Node_Str","String_Node_Str"),new SignatureTestVector("String_Node_Str","String_Node_Str","String_Node_Str"),new SignatureTestVector("String_Node_Str","String_Node_Str","String_Node_Str"),new SignatureTestVector("String_Node_Str","String_Node_Str","String_Node_Str"),new SignatureTestVector("String_Node_Str","String_Node_Str","String_Node_Str"),new SignatureTestVector("String_Node_Str","String_Node_Str","String_Node_Str"),new SignatureTestVector("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str")}) {
    stv.check();
  }
}
Program: 91199
Project: 91199
Buggy source:
private void Source(int index){
  _index=index;
}

Fixed version (ground truth):
void Source(int index){
  _index=index;
}
Program: 91200
Project: 91200
Buggy source:
private void Tag(int index){
  _index=index;
}

Fixed version (ground truth):
void Tag(int index){
  _index=index;
}
Program: 91201
Project: 91201
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  this.requestWindowFeature(Window.FEATURE_NO_TITLE);
  super.onCreate(savedInstanceState);
  setView();
  _mbwManager=MbwManager.getInstance(getApplication());
  UUID accountId=Preconditions.checkNotNull((UUID)getIntent().getSerializableExtra("String_Node_Str"));
  _isColdStorage=getIntent().getBooleanExtra("String_Node_Str",false);
  _account=Preconditions.checkNotNull(_mbwManager.getWalletManager(_isColdStorage).getAccount(accountId));
  _unsigned=Preconditions.checkNotNull((StandardTransactionBuilder.UnsignedTransaction)getIntent().getSerializableExtra("String_Node_Str"));
  if (savedInstanceState != null) {
    _transaction=(Transaction)savedInstanceState.getSerializable("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  this.requestWindowFeature(Window.FEATURE_NO_TITLE);
  super.onCreate(savedInstanceState);
  setView();
  _mbwManager=MbwManager.getInstance(getApplication());
  UUID accountId=Preconditions.checkNotNull((UUID)getIntent().getSerializableExtra("String_Node_Str"));
  _isColdStorage=getIntent().getBooleanExtra("String_Node_Str",false);
  _account=Preconditions.checkNotNull(_mbwManager.getWalletManager(_isColdStorage).getAccount(accountId));
  _unsigned=Preconditions.checkNotNull((UnsignedTransaction)getIntent().getSerializableExtra("String_Node_Str"));
  if (savedInstanceState != null) {
    _transaction=(Transaction)savedInstanceState.getSerializable("String_Node_Str");
  }
}
Program: 91202
Project: 91202
Buggy source:
public static Intent getIntent(Activity currentActivity,UUID account,boolean isColdStorage,StandardTransactionBuilder.UnsignedTransaction unsigned){
  WalletAccount walletAccount=MbwManager.getInstance(currentActivity).getWalletManager(isColdStorage).getAccount(account);
  Class targetClass;
  if (walletAccount instanceof Bip44AccountExternalSignature) {
    final int bip44AccountType=((Bip44AccountExternalSignature)walletAccount).getBIP44AccountType();
switch (bip44AccountType) {
case (Bip44AccountContext.ACCOUNT_TYPE_UNRELATED_X_PUB_EXTERNAL_SIG_LEDGER):
      targetClass=LedgerSignTransactionActivity.class;
    break;
case (Bip44AccountContext.ACCOUNT_TYPE_UNRELATED_X_PUB_EXTERNAL_SIG_KEEPKEY):
  targetClass=KeepKeySignTransactionActivity.class;
break;
case (Bip44AccountContext.ACCOUNT_TYPE_UNRELATED_X_PUB_EXTERNAL_SIG_TREZOR):
targetClass=TrezorSignTransactionActivity.class;
break;
default :
throw new RuntimeException("String_Node_Str" + bip44AccountType);
}
}
 else {
targetClass=SignTransactionActivity.class;
}
Preconditions.checkNotNull(account);
return new Intent(currentActivity,targetClass).putExtra("String_Node_Str",account).putExtra("String_Node_Str",isColdStorage).putExtra("String_Node_Str",unsigned);
}

Fixed version (ground truth):
public static Intent getIntent(Activity currentActivity,UUID account,boolean isColdStorage,UnsignedTransaction unsigned){
  WalletAccount walletAccount=MbwManager.getInstance(currentActivity).getWalletManager(isColdStorage).getAccount(account);
  Class targetClass;
  if (walletAccount instanceof Bip44AccountExternalSignature) {
    final int bip44AccountType=((Bip44AccountExternalSignature)walletAccount).getBIP44AccountType();
switch (bip44AccountType) {
case (Bip44AccountContext.ACCOUNT_TYPE_UNRELATED_X_PUB_EXTERNAL_SIG_LEDGER):
      targetClass=LedgerSignTransactionActivity.class;
    break;
case (Bip44AccountContext.ACCOUNT_TYPE_UNRELATED_X_PUB_EXTERNAL_SIG_KEEPKEY):
  targetClass=KeepKeySignTransactionActivity.class;
break;
case (Bip44AccountContext.ACCOUNT_TYPE_UNRELATED_X_PUB_EXTERNAL_SIG_TREZOR):
targetClass=TrezorSignTransactionActivity.class;
break;
default :
throw new RuntimeException("String_Node_Str" + bip44AccountType);
}
}
 else {
targetClass=SignTransactionActivity.class;
}
Preconditions.checkNotNull(account);
return new Intent(currentActivity,targetClass).putExtra("String_Node_Str",account).putExtra("String_Node_Str",isColdStorage).putExtra("String_Node_Str",unsigned);
}
Program: 91203
Project: 91203
Buggy source:
public static void callMe(Activity currentActivity,UUID account,boolean isColdStorage,StandardTransactionBuilder.UnsignedTransaction unsigned,int requestCode){
  currentActivity.startActivityForResult(getIntent(currentActivity,account,isColdStorage,unsigned),requestCode);
}

Fixed version (ground truth):
public static void callMe(Activity currentActivity,UUID account,boolean isColdStorage,UnsignedTransaction unsigned,int requestCode){
  currentActivity.startActivityForResult(getIntent(currentActivity,account,isColdStorage,unsigned),requestCode);
}
Program: 91204
Project: 91204
Buggy source:
public static int integerify(byte[] B,int Bi,int r){
  int n;
  Bi+=(2 * r - 1) * 64;
  n=(B[Bi + 0] & 0xff) << 0;
  n|=(B[Bi + 1] & 0xff) << 8;
  n|=(B[Bi + 2] & 0xff) << 16;
  n|=(B[Bi + 3] & 0xff) << 24;
  return n;
}

Fixed version (ground truth):
private static int integerify(byte[] B,int Bi,int r){
  int n;
  Bi+=(2 * r - 1) * 64;
  n=(B[Bi + 0] & 0xff) << 0;
  n|=(B[Bi + 1] & 0xff) << 8;
  n|=(B[Bi + 2] & 0xff) << 16;
  n|=(B[Bi + 3] & 0xff) << 24;
  return n;
}
Program: 91205
Project: 91205
Buggy source:
public static void smix(byte[] B,int Bi,int r,int N,byte[][] V,byte[] XY,SCryptProgress progressTracker) throws InterruptedException {
  int Xi=0;
  int Yi=128 * r;
  int i;
  arraycopy(B,Bi,XY,Xi,128 * r);
  for (i=0; i < N; i++) {
    arraycopy(XY,Xi,V[i],0,128 * r);
    blockmix_salsa8(XY,Xi,Yi,r);
    if (progressTracker != null) {
      progressTracker.setProgressN1(i);
    }
  }
  for (i=0; i < N; i++) {
    int j=integerify(XY,Xi,r) & (N - 1);
    blockxor(V[j],0,XY,Xi,128 * r);
    blockmix_salsa8(XY,Xi,Yi,r);
    if (progressTracker != null) {
      progressTracker.setProgressN2(i);
    }
  }
  arraycopy(XY,Xi,B,Bi,128 * r);
}

Fixed version (ground truth):
private static void smix(byte[] B,int Bi,int r,int N,byte[][] V,byte[] XY,SCryptProgress progressTracker) throws InterruptedException {
  int Xi=0;
  int Yi=128 * r;
  int i;
  arraycopy(B,Bi,XY,Xi,128 * r);
  for (i=0; i < N; i++) {
    arraycopy(XY,Xi,V[i],0,128 * r);
    blockmix_salsa8(XY,Xi,Yi,r);
    if (progressTracker != null) {
      progressTracker.setProgressN1(i);
    }
  }
  for (i=0; i < N; i++) {
    int j=integerify(XY,Xi,r) & (N - 1);
    blockxor(V[j],0,XY,Xi,128 * r);
    blockmix_salsa8(XY,Xi,Yi,r);
    if (progressTracker != null) {
      progressTracker.setProgressN2(i);
    }
  }
  arraycopy(XY,Xi,B,Bi,128 * r);
}
Program: 91206
Project: 91206
Buggy source:
/** 
 * Implementation of the <a href="http://www.tarsnap.com/scrypt/scrypt.pdf"/>scrypt KDF</a>. Calls the native implementation   {@link #scryptN} when the native library wassuccessfully loaded, otherwise calls  {@link #scryptJ}.
 * @param passwd Password.
 * @param salt Salt.
 * @param N CPU cost parameter.
 * @param r Memory cost parameter.
 * @param p Parallelization parameter.
 * @param dkLen Intended length of the derived key.
 * @return The derived key.
 * @throws GeneralSecurityException when HMAC_SHA256 is not available.
 * @throws InterruptedException
 */
public static byte[] scrypt(byte[] passwd,byte[] salt,int N,int r,int p,int dkLen,SCryptProgress progressTracker) throws GeneralSecurityException, InterruptedException {
  return native_library_loaded ? scryptN(passwd,salt,N,r,p,dkLen) : scryptJ(passwd,salt,N,r,p,dkLen,progressTracker);
}

Fixed version (ground truth):
/** 
 * Pure Java implementation of the <a href="http://www.tarsnap.com/scrypt/scrypt.pdf"/>scrypt KDF</a>.
 * @param passwd Password.
 * @param salt Salt.
 * @param N CPU cost parameter.
 * @param r Memory cost parameter.
 * @param p Parallelization parameter.
 * @param dkLen Intended length of the derived key.
 * @return The derived key.
 * @throws GeneralSecurityException when HMAC_SHA256 is not available.
 * @throws InterruptedException
 */
public static byte[] scrypt(byte[] passwd,byte[] salt,int N,int r,int p,int dkLen,SCryptProgress progressTracker) throws GeneralSecurityException, InterruptedException {
  if (N == 0 || (N & (N - 1)) != 0)   throw new IllegalArgumentException("String_Node_Str");
  if (N > MAX_VALUE / 128 / r)   throw new IllegalArgumentException("String_Node_Str");
  if (r > MAX_VALUE / 128 / p)   throw new IllegalArgumentException("String_Node_Str");
  Mac mac=Mac.getInstance("String_Node_Str");
  mac.init(new SecretKeySpec(passwd,"String_Node_Str"));
  byte[] DK=new byte[dkLen];
  byte[] B=new byte[128 * r * p];
  byte[] XY=new byte[256 * r];
  byte[][] V=new byte[N][];
  for (int i=0; i < N; i++) {
    V[i]=new byte[128 * r];
  }
  int i;
  PBKDF.pbkdf2(mac,salt,1,B,p * 128 * r);
  for (i=0; i < p; i++) {
    smix(B,i * 128 * r,r,N,V,XY,progressTracker);
    if (progressTracker != null) {
      progressTracker.setProgressP(i + 1);
    }
  }
  PBKDF.pbkdf2(mac,B,1,DK,dkLen);
  return DK;
}
Program: 91207
Project: 91207
Buggy source:
public static void blockxor(byte[] S,int Si,byte[] D,int Di,int len){
  for (int i=0; i < len; i++) {
    D[Di + i]^=S[Si + i];
  }
}

Fixed version (ground truth):
private static void blockxor(byte[] S,int Si,byte[] D,int Di,int len){
  for (int i=0; i < len; i++) {
    D[Di + i]^=S[Si + i];
  }
}
Program: 91208
Project: 91208
Buggy source:
public static void blockmix_salsa8(byte[] BY,int Bi,int Yi,int r){
  byte[] X=new byte[64];
  int i;
  arraycopy(BY,Bi + (2 * r - 1) * 64,X,0,64);
  for (i=0; i < 2 * r; i++) {
    blockxor(BY,i * 64,X,0,64);
    salsa20_8(X);
    arraycopy(X,0,BY,Yi + (i * 64),64);
  }
  for (i=0; i < r; i++) {
    arraycopy(BY,Yi + (i * 2) * 64,BY,Bi + (i * 64),64);
  }
  for (i=0; i < r; i++) {
    arraycopy(BY,Yi + (i * 2 + 1) * 64,BY,Bi + (i + r) * 64,64);
  }
}

Fixed version (ground truth):
private static void blockmix_salsa8(byte[] BY,int Bi,int Yi,int r){
  byte[] X=new byte[64];
  int i;
  arraycopy(BY,Bi + (2 * r - 1) * 64,X,0,64);
  for (i=0; i < 2 * r; i++) {
    blockxor(BY,i * 64,X,0,64);
    salsa20_8(X);
    arraycopy(X,0,BY,Yi + (i * 64),64);
  }
  for (i=0; i < r; i++) {
    arraycopy(BY,Yi + (i * 2) * 64,BY,Bi + (i * 64),64);
  }
  for (i=0; i < r; i++) {
    arraycopy(BY,Yi + (i * 2 + 1) * 64,BY,Bi + (i + r) * 64,64);
  }
}
Program: 91209
Project: 91209
Buggy source:
public static void salsa20_8(byte[] B){
  int[] B32=new int[16];
  int[] x=new int[16];
  int i;
  for (i=0; i < 16; i++) {
    B32[i]=(B[i * 4 + 0] & 0xff) << 0;
    B32[i]|=(B[i * 4 + 1] & 0xff) << 8;
    B32[i]|=(B[i * 4 + 2] & 0xff) << 16;
    B32[i]|=(B[i * 4 + 3] & 0xff) << 24;
  }
  arraycopy(B32,0,x,0,16);
  for (i=8; i > 0; i-=2) {
    x[4]^=R(x[0] + x[12],7);
    x[8]^=R(x[4] + x[0],9);
    x[12]^=R(x[8] + x[4],13);
    x[0]^=R(x[12] + x[8],18);
    x[9]^=R(x[5] + x[1],7);
    x[13]^=R(x[9] + x[5],9);
    x[1]^=R(x[13] + x[9],13);
    x[5]^=R(x[1] + x[13],18);
    x[14]^=R(x[10] + x[6],7);
    x[2]^=R(x[14] + x[10],9);
    x[6]^=R(x[2] + x[14],13);
    x[10]^=R(x[6] + x[2],18);
    x[3]^=R(x[15] + x[11],7);
    x[7]^=R(x[3] + x[15],9);
    x[11]^=R(x[7] + x[3],13);
    x[15]^=R(x[11] + x[7],18);
    x[1]^=R(x[0] + x[3],7);
    x[2]^=R(x[1] + x[0],9);
    x[3]^=R(x[2] + x[1],13);
    x[0]^=R(x[3] + x[2],18);
    x[6]^=R(x[5] + x[4],7);
    x[7]^=R(x[6] + x[5],9);
    x[4]^=R(x[7] + x[6],13);
    x[5]^=R(x[4] + x[7],18);
    x[11]^=R(x[10] + x[9],7);
    x[8]^=R(x[11] + x[10],9);
    x[9]^=R(x[8] + x[11],13);
    x[10]^=R(x[9] + x[8],18);
    x[12]^=R(x[15] + x[14],7);
    x[13]^=R(x[12] + x[15],9);
    x[14]^=R(x[13] + x[12],13);
    x[15]^=R(x[14] + x[13],18);
  }
  for (i=0; i < 16; ++i)   B32[i]=x[i] + B32[i];
  for (i=0; i < 16; i++) {
    B[i * 4 + 0]=(byte)(B32[i] >> 0 & 0xff);
    B[i * 4 + 1]=(byte)(B32[i] >> 8 & 0xff);
    B[i * 4 + 2]=(byte)(B32[i] >> 16 & 0xff);
    B[i * 4 + 3]=(byte)(B32[i] >> 24 & 0xff);
  }
}

Fixed version (ground truth):
private static void salsa20_8(byte[] B){
  int[] B32=new int[16];
  int[] x=new int[16];
  int i;
  for (i=0; i < 16; i++) {
    B32[i]=(B[i * 4 + 0] & 0xff) << 0;
    B32[i]|=(B[i * 4 + 1] & 0xff) << 8;
    B32[i]|=(B[i * 4 + 2] & 0xff) << 16;
    B32[i]|=(B[i * 4 + 3] & 0xff) << 24;
  }
  arraycopy(B32,0,x,0,16);
  for (i=8; i > 0; i-=2) {
    x[4]^=R(x[0] + x[12],7);
    x[8]^=R(x[4] + x[0],9);
    x[12]^=R(x[8] + x[4],13);
    x[0]^=R(x[12] + x[8],18);
    x[9]^=R(x[5] + x[1],7);
    x[13]^=R(x[9] + x[5],9);
    x[1]^=R(x[13] + x[9],13);
    x[5]^=R(x[1] + x[13],18);
    x[14]^=R(x[10] + x[6],7);
    x[2]^=R(x[14] + x[10],9);
    x[6]^=R(x[2] + x[14],13);
    x[10]^=R(x[6] + x[2],18);
    x[3]^=R(x[15] + x[11],7);
    x[7]^=R(x[3] + x[15],9);
    x[11]^=R(x[7] + x[3],13);
    x[15]^=R(x[11] + x[7],18);
    x[1]^=R(x[0] + x[3],7);
    x[2]^=R(x[1] + x[0],9);
    x[3]^=R(x[2] + x[1],13);
    x[0]^=R(x[3] + x[2],18);
    x[6]^=R(x[5] + x[4],7);
    x[7]^=R(x[6] + x[5],9);
    x[4]^=R(x[7] + x[6],13);
    x[5]^=R(x[4] + x[7],18);
    x[11]^=R(x[10] + x[9],7);
    x[8]^=R(x[11] + x[10],9);
    x[9]^=R(x[8] + x[11],13);
    x[10]^=R(x[9] + x[8],18);
    x[12]^=R(x[15] + x[14],7);
    x[13]^=R(x[12] + x[15],9);
    x[14]^=R(x[13] + x[12],13);
    x[15]^=R(x[14] + x[13],18);
  }
  for (i=0; i < 16; ++i)   B32[i]=x[i] + B32[i];
  for (i=0; i < 16; i++) {
    B[i * 4 + 0]=(byte)(B32[i] >> 0 & 0xff);
    B[i * 4 + 1]=(byte)(B32[i] >> 8 & 0xff);
    B[i * 4 + 2]=(byte)(B32[i] >> 16 & 0xff);
    B[i * 4 + 3]=(byte)(B32[i] >> 24 & 0xff);
  }
}
Program: 91212
Project: 91212
Buggy source:
public BTChipOutput finalizeInput(byte[] outputScript,String outputAddress,String amount,String fees,String changePath) throws BTChipException {
  boolean oldAPI;
  byte[] path=null;
  if (changePath != null) {
    path=BIP32Utils.splitPath(changePath);
    resolvePath(changePath);
    exchangeApdu(BTCHIP_CLA,BTCHIP_INS_HASH_INPUT_FINALIZE_FULL,(byte)0xFF,(byte)0x00,path,null);
    oldAPI=((lastSW == SW_INCORRECT_P1_P2) || (lastSW == SW_WRONG_P1_P2) || (lastSW == SW_CONDITIONS_NOT_SATISFIED));
  }
 else {
    exchangeApdu(BTCHIP_CLA,BTCHIP_INS_HASH_INPUT_FINALIZE_FULL,(byte)0xFF,(byte)0x00,new byte[1],null);
    oldAPI=((lastSW == SW_INCORRECT_P1_P2) || (lastSW == SW_WRONG_P1_P2) || (lastSW == SW_CONDITIONS_NOT_SATISFIED));
  }
  if (oldAPI) {
    return finalizeInput(outputAddress,amount,fees,changePath);
  }
 else {
    return finalizeInputFull(outputScript,null,true);
  }
}

Fixed version (ground truth):
public BTChipOutput finalizeInput(byte[] outputScript,String outputAddress,String amount,String fees,String changePath) throws BTChipException {
  boolean oldAPI;
  byte[] path;
  if (changePath != null) {
    path=BIP32Utils.splitPath(changePath);
    resolvePath(changePath);
    exchangeApdu(BTCHIP_CLA,BTCHIP_INS_HASH_INPUT_FINALIZE_FULL,(byte)0xFF,(byte)0x00,path,null);
    oldAPI=((lastSW == SW_INCORRECT_P1_P2) || (lastSW == SW_WRONG_P1_P2) || (lastSW == SW_CONDITIONS_NOT_SATISFIED));
  }
 else {
    exchangeApdu(BTCHIP_CLA,BTCHIP_INS_HASH_INPUT_FINALIZE_FULL,(byte)0xFF,(byte)0x00,new byte[1],null);
    oldAPI=((lastSW == SW_INCORRECT_P1_P2) || (lastSW == SW_WRONG_P1_P2) || (lastSW == SW_CONDITIONS_NOT_SATISFIED));
  }
  if (oldAPI) {
    return finalizeInput(outputAddress,amount,fees,changePath);
  }
 else {
    return finalizeInputFull(outputScript,null,true);
  }
}
Program: 91213
Project: 91213
Buggy source:
@Test public void testPostcode() throws IOException, RemoteGeocodeException {
  final InputStream stream=Preconditions.checkNotNull(getClass().getResourceAsStream("String_Node_Str"));
  @SuppressWarnings("String_Node_Str") GeocodeResponse response=new GoogleMapsGeocoder("String_Node_Str").response2Graph(stream);
}

Fixed version (ground truth):
@Test public void testPostcode() throws IOException, RemoteGeocodeException {
  final InputStream stream=Preconditions.checkNotNull(getClass().getResourceAsStream("String_Node_Str"));
  new GoogleMapsGeocoder("String_Node_Str").response2Graph(stream);
}
Program: 91214
Project: 91214
Buggy source:
private void updateUI(){
  BipSss.Share last=shares.get(shares.size() - 1);
  String status=getString(R.string.sss_share_number_scanned,last.shareNumber);
  try {
    String secret=BipSss.combine(shares);
    Intent result=new Intent();
    result.putExtra(RESULT_SECRET,secret);
    setResult(RESULT_OK,result);
    finish();
    return;
  }
 catch (  BipSss.IncompatibleSharesException e) {
    status+="String_Node_Str";
    status+=getString(R.string.sss_incompatible_shares_warning);
    shares.remove(last);
  }
catch (  BipSss.NotEnoughSharesException e) {
    status+="String_Node_Str";
    if (e.needed == 1) {
      status+=getString(R.string.sss_one_more_share_needed);
    }
 else {
      status+=getString(R.string.sss_more_shares_needed,e.needed);
    }
  }
catch (  BipSss.InvalidContentTypeException e) {
    status+="String_Node_Str";
    status=getString(R.string.sss_unrecognized_share_warning);
  }
  ((TextView)findViewById(R.id.tvStatus)).setText(status);
}

Fixed version (ground truth):
private void updateUI(){
  BipSss.Share last=shares.get(shares.size() - 1);
  String status=getString(R.string.sss_share_number_scanned,last.shareNumber);
  try {
    String secret=BipSss.combine(shares);
    Intent result=new Intent();
    result.putExtra(RESULT_SECRET,secret);
    setResult(RESULT_OK,result);
    finish();
    return;
  }
 catch (  BipSss.IncompatibleSharesException e) {
    status+="String_Node_Str";
    status+=getString(R.string.sss_incompatible_shares_warning);
    shares.remove(last);
  }
catch (  BipSss.NotEnoughSharesException e) {
    status+="String_Node_Str";
    if (e.needed == 1) {
      status+=getString(R.string.sss_one_more_share_needed);
    }
 else {
      status+=getString(R.string.sss_more_shares_needed,e.needed);
    }
  }
catch (  BipSss.InvalidContentTypeException e) {
    status+="String_Node_Str";
    status+=getString(R.string.sss_unrecognized_share_warning);
  }
  ((TextView)findViewById(R.id.tvStatus)).setText(status);
}
Program: 91216
Project: 91216
Buggy source:
@Override protected void onResume(){
  super.onResume();
  String uriString=getIntent().getStringExtra("String_Node_Str");
  Uri uri=Uri.parse(uriString);
  final boolean success=uri.getQueryParameter("String_Node_Str").equals("String_Node_Str");
  glideraService=GlideraService.getInstance();
  glideraService.status().observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<StatusResponse>(){
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
      handleError();
    }
    @Override public void onNext(    StatusResponse statusResponse){
      if (statusResponse.isUserCanTransact()) {
        Intent intent=new Intent(GlideraSendToNextStep.this,GlideraMainActivity.class);
        startActivity(intent);
        finish();
      }
 else {
        if (success) {
          String uri=glideraService.getSetupUrl();
          Utils.openWebsite(GlideraSendToNextStep.this,uri);
        }
 else {
          handleError();
        }
      }
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  String uriString=getIntent().getStringExtra("String_Node_Str");
  Uri uri=Uri.parse(uriString);
  final String status=uri.getQueryParameter("String_Node_Str");
  glideraService=GlideraService.getInstance();
  glideraService.status().observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<StatusResponse>(){
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
      handleError();
    }
    @Override public void onNext(    StatusResponse statusResponse){
      if (statusResponse.isUserCanTransact()) {
        Intent intent=new Intent(GlideraSendToNextStep.this,GlideraMainActivity.class);
        startActivity(intent);
        finish();
      }
 else {
        if (status != null && status.equals("String_Node_Str")) {
          String uri=glideraService.getSetupUrl();
          Utils.openWebsite(GlideraSendToNextStep.this,uri);
        }
 else         if (status != null && status.equals("String_Node_Str")) {
          Intent intent=new Intent(GlideraSendToNextStep.this,BuySellSelect.class);
          startActivity(intent);
          finish();
        }
 else {
          handleError();
        }
      }
    }
  }
);
}
Program: 91217
Project: 91217
Buggy source:
@Override public void onNext(StatusResponse statusResponse){
  if (statusResponse.isUserCanTransact()) {
    Intent intent=new Intent(GlideraSendToNextStep.this,GlideraMainActivity.class);
    startActivity(intent);
    finish();
  }
 else {
    if (success) {
      String uri=glideraService.getSetupUrl();
      Utils.openWebsite(GlideraSendToNextStep.this,uri);
    }
 else {
      handleError();
    }
  }
}

Fixed version (ground truth):
@Override public void onNext(StatusResponse statusResponse){
  if (statusResponse.isUserCanTransact()) {
    Intent intent=new Intent(GlideraSendToNextStep.this,GlideraMainActivity.class);
    startActivity(intent);
    finish();
  }
 else {
    if (status != null && status.equals("String_Node_Str")) {
      String uri=glideraService.getSetupUrl();
      Utils.openWebsite(GlideraSendToNextStep.this,uri);
    }
 else     if (status != null && status.equals("String_Node_Str")) {
      Intent intent=new Intent(GlideraSendToNextStep.this,BuySellSelect.class);
      startActivity(intent);
      finish();
    }
 else {
      handleError();
    }
  }
}