nus-yam/ex-repair huggingface dataset:
Program: 124506
Project: 124506
Buggy source:
@Override public boolean onContextItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.wallet_options_safety:
    HelpDialogFragment.page(getFragmentManager(),R.string.help_safety);
  return true;
case R.id.wallet_options_backup_wallet:
handleBackupWallet();
return true;
case R.id.wallet_options_restore_wallet:
showDialog(DIALOG_RESTORE_WALLET);
return true;
case R.id.wallet_options_encrypt_keys:
handleEncryptKeys();
return true;
}
return super.onContextItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onContextItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.wallet_options_safety:
    HelpDialogFragment.page(getFragmentManager(),R.string.help_safety);
  return true;
case R.id.wallet_options_backup_wallet:
handleBackupWallet();
return true;
case R.id.wallet_options_restore_wallet:
handleRestoreWallet();
return true;
case R.id.wallet_options_encrypt_keys:
handleEncryptKeys();
return true;
}
return super.onContextItemSelected(item);
}
Program: 124507
Project: 124507
Buggy source:
public static String getAddress(final BluetoothAdapter adapter){
  if (adapter == null)   return null;
  final String address=adapter.getAddress();
  if (!MARSHMELLOW_FAKE_MAC.equals(address))   return address;
  try {
    final Field mServiceField=BluetoothAdapter.class.getDeclaredField("String_Node_Str");
    mServiceField.setAccessible(true);
    final Object mService=mServiceField.get(adapter);
    if (mService == null)     return null;
    return (String)mService.getClass().getMethod("String_Node_Str").invoke(mService);
  }
 catch (  final ReflectiveOperationException x) {
    throw new RuntimeException(x);
  }
}

Fixed version (ground truth):
public static String getAddress(final BluetoothAdapter adapter){
  if (adapter == null)   return null;
  final String address=adapter.getAddress();
  if (!MARSHMELLOW_FAKE_MAC.equals(address))   return address;
  try {
    final Field mServiceField=BluetoothAdapter.class.getDeclaredField("String_Node_Str");
    mServiceField.setAccessible(true);
    final Object mService=mServiceField.get(adapter);
    if (mService == null)     return null;
    return (String)mService.getClass().getMethod("String_Node_Str").invoke(mService);
  }
 catch (  final Exception x) {
    throw new RuntimeException(x);
  }
}
Program: 124508
Project: 124508
Buggy source:
private boolean isValidAmount(final boolean zeroIsValid){
  final String str=textView.getText().toString().trim();
  try {
    if (!str.isEmpty()) {
      final Monetary amount;
      if (localCurrencyCode == null)       amount=inputFormat.parse(str);
 else       amount=inputFormat.parseFiat(localCurrencyCode,str);
      return zeroIsValid || amount.signum() > 0;
    }
  }
 catch (  final Exception x) {
  }
  return false;
}

Fixed version (ground truth):
private boolean isValidAmount(final boolean zeroIsValid){
  final String str=textView.getText().toString().trim();
  try {
    if (!str.isEmpty()) {
      final Monetary amount;
      if (localCurrencyCode == null) {
        amount=inputFormat.parse(str);
        if (((Coin)amount).isGreaterThan(Constants.NETWORK_PARAMETERS.getMaxMoney()))         return false;
      }
 else {
        amount=inputFormat.parseFiat(localCurrencyCode,str);
      }
      return zeroIsValid || amount.signum() > 0;
    }
  }
 catch (  final Exception x) {
  }
  return false;
}
Program: 124509
Project: 124509
Buggy source:
/** 
 * Password based encryption using AES - CBC 256 bits.
 * @param plainBytes The bytes to encrypt
 * @param password The password to use for encryption
 * @return SALT_LENGTH bytes of salt followed by the encrypted bytes.
 * @throws IOException
 */
private static byte[] encrypt(final byte[] plainTextAsBytes,final char[] password) throws IOException {
  try {
    final byte[] salt=new byte[SALT_LENGTH];
    secureRandom.nextBytes(salt);
    final ParametersWithIV key=(ParametersWithIV)getAESPasswordKey(password,salt);
    final BufferedBlockCipher cipher=new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESFastEngine()));
    cipher.init(true,key);
    final byte[] encryptedBytes=new byte[cipher.getOutputSize(plainTextAsBytes.length)];
    final int length=cipher.processBytes(plainTextAsBytes,0,plainTextAsBytes.length,encryptedBytes,0);
    cipher.doFinal(encryptedBytes,length);
    return concat(salt,encryptedBytes);
  }
 catch (  final InvalidCipherTextException x) {
    throw new IOException("String_Node_Str",x);
  }
catch (  final DataLengthException x) {
    throw new IOException("String_Node_Str",x);
  }
}

Fixed version (ground truth):
/** 
 * Password based encryption using AES - CBC 256 bits.
 * @param plainBytes The bytes to encrypt
 * @param password The password to use for encryption
 * @return SALT_LENGTH bytes of salt followed by the encrypted bytes.
 * @throws IOException
 */
private static byte[] encrypt(final byte[] plainTextAsBytes,final char[] password) throws IOException {
  try {
    final byte[] salt=new byte[SALT_LENGTH];
    secureRandom.nextBytes(salt);
    final ParametersWithIV key=(ParametersWithIV)getAESPasswordKey(password,salt);
    final BufferedBlockCipher cipher=new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESFastEngine()));
    cipher.init(true,key);
    final byte[] encryptedBytes=new byte[cipher.getOutputSize(plainTextAsBytes.length)];
    final int processLen=cipher.processBytes(plainTextAsBytes,0,plainTextAsBytes.length,encryptedBytes,0);
    final int doFinalLen=cipher.doFinal(encryptedBytes,processLen);
    return concat(salt,Arrays.copyOf(encryptedBytes,processLen + doFinalLen));
  }
 catch (  final InvalidCipherTextException x) {
    throw new IOException("String_Node_Str",x);
  }
catch (  final DataLengthException x) {
    throw new IOException("String_Node_Str",x);
  }
}
Program: 124510
Project: 124510
Buggy source:
/** 
 * Decrypt bytes previously encrypted with this class.
 * @param bytesToDecode The bytes to decrypt
 * @param passwordbThe password to use for decryption
 * @return The decrypted bytes
 * @throws IOException
 */
private static byte[] decrypt(final byte[] bytesToDecode,final char[] password) throws IOException {
  try {
    final byte[] salt=new byte[SALT_LENGTH];
    System.arraycopy(bytesToDecode,0,salt,0,SALT_LENGTH);
    final byte[] cipherBytes=new byte[bytesToDecode.length - SALT_LENGTH];
    System.arraycopy(bytesToDecode,SALT_LENGTH,cipherBytes,0,bytesToDecode.length - SALT_LENGTH);
    final ParametersWithIV key=(ParametersWithIV)getAESPasswordKey(password,salt);
    final BufferedBlockCipher cipher=new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESFastEngine()));
    cipher.init(false,key);
    final byte[] decryptedBytes=new byte[cipher.getOutputSize(cipherBytes.length)];
    final int length=cipher.processBytes(cipherBytes,0,cipherBytes.length,decryptedBytes,0);
    cipher.doFinal(decryptedBytes,length);
    return decryptedBytes;
  }
 catch (  final InvalidCipherTextException x) {
    throw new IOException("String_Node_Str",x);
  }
catch (  final DataLengthException x) {
    throw new IOException("String_Node_Str",x);
  }
}

Fixed version (ground truth):
/** 
 * Decrypt bytes previously encrypted with this class.
 * @param bytesToDecode The bytes to decrypt
 * @param passwordbThe password to use for decryption
 * @return The decrypted bytes
 * @throws IOException
 */
private static byte[] decrypt(final byte[] bytesToDecode,final char[] password) throws IOException {
  try {
    final byte[] salt=new byte[SALT_LENGTH];
    System.arraycopy(bytesToDecode,0,salt,0,SALT_LENGTH);
    final byte[] cipherBytes=new byte[bytesToDecode.length - SALT_LENGTH];
    System.arraycopy(bytesToDecode,SALT_LENGTH,cipherBytes,0,bytesToDecode.length - SALT_LENGTH);
    final ParametersWithIV key=(ParametersWithIV)getAESPasswordKey(password,salt);
    final BufferedBlockCipher cipher=new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESFastEngine()));
    cipher.init(false,key);
    final byte[] decryptedBytes=new byte[cipher.getOutputSize(cipherBytes.length)];
    final int processLen=cipher.processBytes(cipherBytes,0,cipherBytes.length,decryptedBytes,0);
    final int doFinalLen=cipher.doFinal(decryptedBytes,processLen);
    return Arrays.copyOf(decryptedBytes,processLen + doFinalLen);
  }
 catch (  final InvalidCipherTextException x) {
    throw new IOException("String_Node_Str",x);
  }
catch (  final DataLengthException x) {
    throw new IOException("String_Node_Str",x);
  }
}
Program: 124512
Project: 124512
Buggy source:
public static ExchangeRate getExchangeRate(final Cursor cursor){
  final String currencyCode=cursor.getString(cursor.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_CURRENCY_CODE));
  final double rate=cursor.getDouble(cursor.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_RATE));
  final String source=cursor.getString(cursor.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_SOURCE));
  return new ExchangeRate(currencyCode,rate,source);
}

Fixed version (ground truth):
public static ExchangeRate getExchangeRate(final Cursor cursor){
  final String currencyCode=cursor.getString(cursor.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_CURRENCY_CODE));
  final BigInteger rate=BigInteger.valueOf(cursor.getLong(cursor.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_RATE)));
  final String source=cursor.getString(cursor.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_SOURCE));
  return new ExchangeRate(currencyCode,rate,source);
}
Program: 124513
Project: 124513
Buggy source:
private static Map<String,ExchangeRate> getBitcoinCharts(){
  try {
    final URL URL=new URL("String_Node_Str");
    final URLConnection connection=URL.openConnection();
    connection.connect();
    final StringBuilder content=new StringBuilder();
    Reader reader=null;
    try {
      reader=new InputStreamReader(new BufferedInputStream(connection.getInputStream(),1024));
      IOUtils.copy(reader,content);
      final Map<String,ExchangeRate> rates=new TreeMap<String,ExchangeRate>();
      final JSONObject head=new JSONObject(content.toString());
      for (final Iterator<String> i=head.keys(); i.hasNext(); ) {
        final String currencyCode=i.next();
        if (!"String_Node_Str".equals(currencyCode)) {
          final JSONObject o=head.getJSONObject(currencyCode);
          double rate=o.optDouble("String_Node_Str",0);
          if (rate == 0)           rate=o.optDouble("String_Node_Str",0);
          if (rate == 0)           rate=o.optDouble("String_Node_Str",0);
          if (rate != 0)           rates.put(currencyCode,new ExchangeRate(currencyCode,rate,URL.getHost()));
        }
      }
      return rates;
    }
  finally {
      if (reader != null)       reader.close();
    }
  }
 catch (  final IOException x) {
    x.printStackTrace();
  }
catch (  final JSONException x) {
    x.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
private static Map<String,ExchangeRate> getBitcoinCharts(){
  try {
    final URL URL=new URL("String_Node_Str");
    final URLConnection connection=URL.openConnection();
    connection.connect();
    final StringBuilder content=new StringBuilder();
    Reader reader=null;
    try {
      reader=new InputStreamReader(new BufferedInputStream(connection.getInputStream(),1024));
      IOUtils.copy(reader,content);
      final Map<String,ExchangeRate> rates=new TreeMap<String,ExchangeRate>();
      final JSONObject head=new JSONObject(content.toString());
      for (final Iterator<String> i=head.keys(); i.hasNext(); ) {
        final String currencyCode=i.next();
        if (!"String_Node_Str".equals(currencyCode)) {
          final JSONObject o=head.getJSONObject(currencyCode);
          String rate=o.optString("String_Node_Str",null);
          if (rate == null)           rate=o.optString("String_Node_Str",null);
          if (rate == null)           rate=o.optString("String_Node_Str",null);
          if (rate != null)           rates.put(currencyCode,new ExchangeRate(currencyCode,Utils.toNanoCoins(rate),URL.getHost()));
        }
      }
      return rates;
    }
  finally {
      if (reader != null)       reader.close();
    }
  }
 catch (  final IOException x) {
    x.printStackTrace();
  }
catch (  final JSONException x) {
    x.printStackTrace();
  }
  return null;
}
Program: 124514
Project: 124514
Buggy source:
public ExchangeRate(final String currencyCode,final double rate,final String source){
  this.currencyCode=currencyCode;
  this.rate=rate;
  this.source=source;
}

Fixed version (ground truth):
public ExchangeRate(final String currencyCode,final BigInteger rate,final String source){
  this.currencyCode=currencyCode;
  this.rate=rate;
  this.source=source;
}
Program: 124515
Project: 124515
Buggy source:
private static Map<String,ExchangeRate> getBlockchainInfo(){
  try {
    final URL URL=new URL("String_Node_Str");
    final URLConnection connection=URL.openConnection();
    connection.connect();
    final StringBuilder content=new StringBuilder();
    Reader reader=null;
    try {
      reader=new InputStreamReader(new BufferedInputStream(connection.getInputStream(),1024));
      IOUtils.copy(reader,content);
      final Map<String,ExchangeRate> rates=new TreeMap<String,ExchangeRate>();
      final JSONObject head=new JSONObject(content.toString());
      for (final Iterator<String> i=head.keys(); i.hasNext(); ) {
        final String currencyCode=i.next();
        final JSONObject o=head.getJSONObject(currencyCode);
        final double rate=o.optDouble("String_Node_Str",0);
        if (rate != 0)         rates.put(currencyCode,new ExchangeRate(currencyCode,rate,URL.getHost()));
      }
      return rates;
    }
  finally {
      if (reader != null)       reader.close();
    }
  }
 catch (  final IOException x) {
    x.printStackTrace();
  }
catch (  final JSONException x) {
    x.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
private static Map<String,ExchangeRate> getBlockchainInfo(){
  try {
    final URL URL=new URL("String_Node_Str");
    final URLConnection connection=URL.openConnection();
    connection.connect();
    final StringBuilder content=new StringBuilder();
    Reader reader=null;
    try {
      reader=new InputStreamReader(new BufferedInputStream(connection.getInputStream(),1024));
      IOUtils.copy(reader,content);
      final Map<String,ExchangeRate> rates=new TreeMap<String,ExchangeRate>();
      final JSONObject head=new JSONObject(content.toString());
      for (final Iterator<String> i=head.keys(); i.hasNext(); ) {
        final String currencyCode=i.next();
        final JSONObject o=head.getJSONObject(currencyCode);
        final String rate=o.optString("String_Node_Str",null);
        if (rate != null)         rates.put(currencyCode,new ExchangeRate(currencyCode,Utils.toNanoCoins(rate),URL.getHost()));
      }
      return rates;
    }
  finally {
      if (reader != null)       reader.close();
    }
  }
 catch (  final IOException x) {
    x.printStackTrace();
  }
catch (  final JSONException x) {
    x.printStackTrace();
  }
  return null;
}
Program: 124516
Project: 124516
Buggy source:
@Override public Cursor query(final Uri uri,final String[] projection,final String selection,final String[] selectionArgs,final String sortOrder){
  final long now=System.currentTimeMillis();
  if (exchangeRates == null || now - lastUpdated > UPDATE_FREQ_MS) {
    Map<String,ExchangeRate> newExchangeRates=getBitcoinCharts();
    if (exchangeRates == null && newExchangeRates == null)     newExchangeRates=getBlockchainInfo();
    if (newExchangeRates != null) {
      exchangeRates=newExchangeRates;
      lastUpdated=now;
    }
  }
  if (exchangeRates == null)   return null;
  final MatrixCursor cursor=new MatrixCursor(new String[]{BaseColumns._ID,KEY_CURRENCY_CODE,KEY_RATE,KEY_SOURCE});
  if (selection == null) {
    for (    final Map.Entry<String,ExchangeRate> entry : exchangeRates.entrySet()) {
      final ExchangeRate rate=entry.getValue();
      cursor.newRow().add(entry.getKey().hashCode()).add(rate.currencyCode).add(rate.rate).add(rate.source);
    }
  }
 else   if (selection.equals(KEY_CURRENCY_CODE)) {
    final String code=selectionArgs[0];
    final ExchangeRate rate=exchangeRates.get(code);
    cursor.newRow().add(code.hashCode()).add(rate.currencyCode).add(rate.rate).add(rate.source);
  }
  return cursor;
}

Fixed version (ground truth):
@Override public Cursor query(final Uri uri,final String[] projection,final String selection,final String[] selectionArgs,final String sortOrder){
  final long now=System.currentTimeMillis();
  if (exchangeRates == null || now - lastUpdated > UPDATE_FREQ_MS) {
    Map<String,ExchangeRate> newExchangeRates=getBitcoinCharts();
    if (exchangeRates == null && newExchangeRates == null)     newExchangeRates=getBlockchainInfo();
    if (newExchangeRates != null) {
      exchangeRates=newExchangeRates;
      lastUpdated=now;
    }
  }
  if (exchangeRates == null)   return null;
  final MatrixCursor cursor=new MatrixCursor(new String[]{BaseColumns._ID,KEY_CURRENCY_CODE,KEY_RATE,KEY_SOURCE});
  if (selection == null) {
    for (    final Map.Entry<String,ExchangeRate> entry : exchangeRates.entrySet()) {
      final ExchangeRate rate=entry.getValue();
      cursor.newRow().add(entry.getKey().hashCode()).add(rate.currencyCode).add(rate.rate.longValue()).add(rate.source);
    }
  }
 else   if (selection.equals(KEY_CURRENCY_CODE)) {
    final String code=selectionArgs[0];
    final ExchangeRate rate=exchangeRates.get(code);
    cursor.newRow().add(code.hashCode()).add(rate.currencyCode).add(rate.rate.longValue()).add(rate.source);
  }
  return cursor;
}
Program: 124518
Project: 124518
Buggy source:
private void updateAppearance(){
  if (exchangeRate != null) {
    localAmountView.setEnabled(true);
    final BigDecimal bdRate=new BigDecimal(exchangeRate.rate);
    if (exchangeDirection) {
      final BigInteger btcAmount=btcAmountView.getAmount();
      if (btcAmount != null) {
        localAmountView.setAmount(null);
        localAmountView.setHint(new BigDecimal(btcAmount).multiply(bdRate).toBigInteger());
        btcAmountView.setHint(null);
      }
    }
 else {
      final BigInteger localAmount=localAmountView.getAmount();
      if (localAmount != null) {
        btcAmountView.setAmount(null);
        btcAmountView.setHint(new BigDecimal(localAmount).divide(bdRate,RoundingMode.HALF_UP).toBigInteger());
        localAmountView.setHint(null);
      }
    }
    exchangeRateView.setText(getString(R.string.amount_calculator_dialog_exchange_rate,exchangeCurrency,WalletUtils.formatValue(WalletUtils.localValue(Utils.COIN,bdRate)),exchangeRate.source));
  }
 else {
    localAmountView.setEnabled(false);
    exchangeRateView.setText(R.string.amount_calculator_dialog_exchange_rate_not_available);
  }
}

Fixed version (ground truth):
private void updateAppearance(){
  if (exchangeRate != null) {
    localAmountView.setEnabled(true);
    if (exchangeDirection) {
      final BigInteger btcAmount=btcAmountView.getAmount();
      if (btcAmount != null) {
        localAmountView.setAmount(null);
        localAmountView.setHint(WalletUtils.localValue(btcAmount,exchangeRate.rate));
        btcAmountView.setHint(null);
      }
    }
 else {
      final BigInteger localAmount=localAmountView.getAmount();
      if (localAmount != null) {
        btcAmountView.setAmount(null);
        btcAmountView.setHint(WalletUtils.btcValue(localAmount,exchangeRate.rate));
        localAmountView.setHint(null);
      }
    }
    exchangeRateView.setText(getString(R.string.amount_calculator_dialog_exchange_rate,exchangeCurrency,WalletUtils.formatValue(WalletUtils.localValue(Utils.COIN,exchangeRate.rate)),exchangeRate.source));
  }
 else {
    localAmountView.setEnabled(false);
    exchangeRateView.setText(R.string.amount_calculator_dialog_exchange_rate_not_available);
  }
}
Program: 124519
Project: 124519
Buggy source:
private void done(){
  final BigInteger amount=exchangeDirection ? btcAmountView.getAmount() : new BigDecimal(localAmountView.getAmount()).divide(new BigDecimal(exchangeRate.rate),RoundingMode.HALF_UP).toBigInteger();
  ((Listener)getTargetFragment()).useCalculatedAmount(amount);
  dismiss();
}

Fixed version (ground truth):
private void done(){
  final BigInteger amount=exchangeDirection ? btcAmountView.getAmount() : WalletUtils.btcValue(localAmountView.getAmount(),exchangeRate.rate);
  ((Listener)getTargetFragment()).useCalculatedAmount(amount);
  dismiss();
}
Program: 124520
Project: 124520
Buggy source:
public void setHint(final BigInteger amount){
  final SpannableStringBuilder hint;
  if (amount != null)   hint=new SpannableStringBuilder(WalletUtils.formatValue(amount));
 else   hint=new SpannableStringBuilder("String_Node_Str");
  WalletUtils.formatSignificant(hint,smallerInsignificant);
  textView.setHint(hint);
}

Fixed version (ground truth):
public void setHint(final BigInteger amount){
  final SpannableStringBuilder hint;
  if (amount != null)   hint=new SpannableStringBuilder(WalletUtils.formatValue(amount,precision));
 else   hint=new SpannableStringBuilder("String_Node_Str");
  WalletUtils.formatSignificant(hint,smallerInsignificant);
  textView.setHint(hint);
}
Program: 124521
Project: 124521
Buggy source:
public void setAmount(final BigInteger amount){
  if (amount != null)   textView.setText(amountSigned ? WalletUtils.formatValue(amount,Constants.CURRENCY_PLUS_SIGN,Constants.CURRENCY_MINUS_SIGN) : WalletUtils.formatValue(amount));
 else   textView.setText(null);
}

Fixed version (ground truth):
public void setAmount(final BigInteger amount){
  if (amount != null)   textView.setText(amountSigned ? WalletUtils.formatValue(amount,Constants.CURRENCY_PLUS_SIGN,Constants.CURRENCY_MINUS_SIGN,precision) : WalletUtils.formatValue(amount,precision));
 else   textView.setText(null);
}
Program: 124522
Project: 124522
Buggy source:
@Override public void bindView(final View view,final Context context,final Cursor cursor){
  final ExchangeRate exchangeRate=ExchangeRatesProvider.getExchangeRate(cursor);
  final BigDecimal bdRate=new BigDecimal(exchangeRate.rate);
  final boolean isDefaultCurrency=exchangeRate.currencyCode.equals(defaultCurrency);
  view.setBackgroundResource(isDefaultCurrency ? R.color.bg_less_bright : R.color.bg_bright);
  final View defaultView=view.findViewById(R.id.exchange_rate_row_default);
  defaultView.setVisibility(isDefaultCurrency ? View.VISIBLE : View.INVISIBLE);
  final TextView currencyCodeView=(TextView)view.findViewById(R.id.exchange_rate_row_currency_code);
  currencyCodeView.setText(exchangeRate.currencyCode);
  final CurrencyAmountView rateView=(CurrencyAmountView)view.findViewById(R.id.exchange_rate_row_rate);
  rateView.setCurrencyCode(null);
  rateView.setAmount(WalletUtils.localValue(Utils.COIN,bdRate));
  final CurrencyAmountView walletView=(CurrencyAmountView)view.findViewById(R.id.exchange_rate_row_balance);
  walletView.setCurrencyCode(null);
  walletView.setAmount(WalletUtils.localValue(balance,bdRate));
  walletView.setStrikeThru(Constants.TEST);
  walletView.setTextColor(getResources().getColor(R.color.fg_less_significant));
}

Fixed version (ground truth):
@Override public void bindView(final View view,final Context context,final Cursor cursor){
  final ExchangeRate exchangeRate=ExchangeRatesProvider.getExchangeRate(cursor);
  final boolean isDefaultCurrency=exchangeRate.currencyCode.equals(defaultCurrency);
  view.setBackgroundResource(isDefaultCurrency ? R.color.bg_less_bright : R.color.bg_bright);
  final View defaultView=view.findViewById(R.id.exchange_rate_row_default);
  defaultView.setVisibility(isDefaultCurrency ? View.VISIBLE : View.INVISIBLE);
  final TextView currencyCodeView=(TextView)view.findViewById(R.id.exchange_rate_row_currency_code);
  currencyCodeView.setText(exchangeRate.currencyCode);
  final CurrencyAmountView rateView=(CurrencyAmountView)view.findViewById(R.id.exchange_rate_row_rate);
  rateView.setCurrencyCode(null);
  rateView.setPrecision(Constants.LOCAL_PRECISION);
  rateView.setAmount(WalletUtils.localValue(Utils.COIN,exchangeRate.rate));
  final CurrencyAmountView walletView=(CurrencyAmountView)view.findViewById(R.id.exchange_rate_row_balance);
  walletView.setCurrencyCode(null);
  walletView.setPrecision(Constants.LOCAL_PRECISION);
  walletView.setAmount(WalletUtils.localValue(balance,exchangeRate.rate));
  walletView.setStrikeThru(Constants.TEST);
  walletView.setTextColor(getResources().getColor(R.color.fg_less_significant));
}
Program: 124524
Project: 124524
Buggy source:
@Override public void onViewCreated(final View view,final Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  viewBalance=(CurrencyAmountView)view.findViewById(R.id.wallet_balance);
  viewBalanceLocal=(CurrencyAmountView)view.findViewById(R.id.wallet_balance_local);
  viewBalanceLocal.setSmallerInsignificant(false);
  viewBalanceLocal.setStrikeThru(Constants.TEST);
}

Fixed version (ground truth):
@Override public void onViewCreated(final View view,final Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  viewBalance=(CurrencyAmountView)view.findViewById(R.id.wallet_balance);
  viewBalanceLocal=(CurrencyAmountView)view.findViewById(R.id.wallet_balance_local);
  viewBalanceLocal.setPrecision(Constants.LOCAL_PRECISION);
  viewBalanceLocal.setSmallerInsignificant(false);
  viewBalanceLocal.setStrikeThru(Constants.TEST);
}
Program: 124525
Project: 124525
Buggy source:
private void updateView(){
  if (!showLocalBalance)   viewBalanceLocal.setVisibility(View.GONE);
  if (balance != null) {
    viewBalance.setVisibility(View.VISIBLE);
    viewBalance.setAmount(balance);
    if (showLocalBalance) {
      if (exchangeRate != null) {
        final BigInteger balance=wallet.getBalance(BalanceType.ESTIMATED);
        final BigDecimal bdRate=new BigDecimal(exchangeRate.rate);
        final BigInteger localValue=WalletUtils.localValue(balance,bdRate);
        viewBalanceLocal.setVisibility(View.VISIBLE);
        viewBalanceLocal.setCurrencyCode(Constants.PREFIX_ALMOST_EQUAL_TO + exchangeRate.currencyCode);
        viewBalanceLocal.setAmount(localValue);
        viewBalanceLocal.setTextColor(getResources().getColor(R.color.fg_less_significant));
      }
 else {
        viewBalanceLocal.setVisibility(View.INVISIBLE);
      }
    }
  }
 else {
    viewBalance.setVisibility(View.INVISIBLE);
  }
}

Fixed version (ground truth):
private void updateView(){
  if (!showLocalBalance)   viewBalanceLocal.setVisibility(View.GONE);
  if (balance != null) {
    viewBalance.setVisibility(View.VISIBLE);
    viewBalance.setAmount(balance);
    if (showLocalBalance) {
      if (exchangeRate != null) {
        final BigInteger balance=wallet.getBalance(BalanceType.ESTIMATED);
        final BigInteger localValue=WalletUtils.localValue(balance,exchangeRate.rate);
        viewBalanceLocal.setVisibility(View.VISIBLE);
        viewBalanceLocal.setCurrencyCode(Constants.PREFIX_ALMOST_EQUAL_TO + exchangeRate.currencyCode);
        viewBalanceLocal.setAmount(localValue);
        viewBalanceLocal.setTextColor(getResources().getColor(R.color.fg_less_significant));
      }
 else {
        viewBalanceLocal.setVisibility(View.INVISIBLE);
      }
    }
  }
 else {
    viewBalance.setVisibility(View.INVISIBLE);
  }
}
Program: 124526
Project: 124526
Buggy source:
public static String formatValue(final BigInteger value,final String plusSign,final String minusSign){
  final boolean negative=value.compareTo(BigInteger.ZERO) < 0;
  final BigInteger absValue=value.abs();
  final String sign=negative ? minusSign : plusSign;
  final int coins=absValue.divide(Utils.COIN).intValue();
  final int cents=absValue.remainder(Utils.COIN).intValue();
  if (cents % 1000000 == 0)   return String.format(Locale.US,"String_Node_Str",sign,coins,cents / 1000000);
 else   if (cents % 10000 == 0)   return String.format(Locale.US,"String_Node_Str",sign,coins,cents / 10000);
 else   return String.format(Locale.US,"String_Node_Str",sign,coins,cents);
}

Fixed version (ground truth):
public static String formatValue(final BigInteger value,final String plusSign,final String minusSign,final int precision){
  final boolean negative=value.compareTo(BigInteger.ZERO) < 0;
  final BigInteger absValue=value.abs();
  final String sign=negative ? minusSign : plusSign;
  final int coins=absValue.divide(Utils.COIN).intValue();
  final int cents=absValue.remainder(Utils.COIN).intValue();
  if (cents % 1000000 == 0 || precision <= 2)   return String.format(Locale.US,"String_Node_Str",sign,coins,cents / 1000000);
 else   if (cents % 10000 == 0 || precision <= 4)   return String.format(Locale.US,"String_Node_Str",sign,coins,cents / 10000);
 else   return String.format(Locale.US,"String_Node_Str",sign,coins,cents);
}
Program: 124527
Project: 124527
Buggy source:
public static BigInteger localValue(final BigInteger btcValue,final BigDecimal exchangeRate){
  final BigDecimal value=new BigDecimal(btcValue).multiply(exchangeRate);
  final BigDecimal remainder=value.remainder(LOCAL_VALUE_PRECISION);
  return value.subtract(remainder).toBigInteger();
}

Fixed version (ground truth):
public static BigInteger localValue(final BigInteger btcValue,final BigInteger rate){
  return btcValue.multiply(rate).divide(Utils.COIN);
}
Program: 124528
Project: 124528
Buggy source:
public void onClick(final DialogInterface dialog,final int which){
  stackTraceFile.delete();
  dialog.dismiss();
}

Fixed version (ground truth):
public void onClick(final DialogInterface dialog,final int which){
  stackTraceFile.delete();
}
Program: 124529
Project: 124529
Buggy source:
public synchronized void check(final Context context){
  if (!stackTraceFile.exists())   return;
  final Builder builder=new AlertDialog.Builder(context).setIcon(android.R.drawable.ic_dialog_alert).setTitle(DIALOG_TITLE).setMessage(DIALOG_MESSAGE);
  builder.setPositiveButton("String_Node_Str",new OnClickListener(){
    public void onClick(    final DialogInterface dialog,    final int which){
      sendError(context);
      stackTraceFile.delete();
    }
  }
);
  builder.setNegativeButton("String_Node_Str",new OnClickListener(){
    public void onClick(    final DialogInterface dialog,    final int which){
      stackTraceFile.delete();
      dialog.dismiss();
    }
  }
);
  try {
    builder.show();
  }
 catch (  final Exception x) {
  }
}

Fixed version (ground truth):
public synchronized void check(final Context context){
  if (!stackTraceFile.exists())   return;
  final Builder builder=new AlertDialog.Builder(context).setIcon(android.R.drawable.ic_dialog_alert).setTitle(DIALOG_TITLE).setMessage(DIALOG_MESSAGE);
  builder.setPositiveButton("String_Node_Str",new OnClickListener(){
    public void onClick(    final DialogInterface dialog,    final int which){
      sendError(context);
      stackTraceFile.delete();
    }
  }
);
  builder.setNegativeButton("String_Node_Str",new OnClickListener(){
    public void onClick(    final DialogInterface dialog,    final int which){
      stackTraceFile.delete();
    }
  }
);
  builder.setOnCancelListener(new OnCancelListener(){
    public void onCancel(    final DialogInterface dialog){
      stackTraceFile.delete();
    }
  }
);
  try {
    builder.show();
  }
 catch (  final Exception x) {
  }
}
Program: 124532
Project: 124532
Buggy source:
private Wallet restoreWalletFromBackup(){
  try {
    final Wallet wallet=readKeys(openFileInput(Constants.WALLET_KEY_BACKUP_BASE58));
    final File file=new File(getDir("String_Node_Str",Context.MODE_WORLD_READABLE | Context.MODE_WORLD_WRITEABLE),Constants.BLOCKCHAIN_FILENAME);
    file.delete();
    Toast.makeText(this,R.string.toast_wallet_reset,Toast.LENGTH_LONG).show();
    return wallet;
  }
 catch (  final IOException x) {
    throw new RuntimeException(x);
  }
}

Fixed version (ground truth):
private Wallet restoreWalletFromBackup(){
  try {
    final Wallet wallet=readKeys(openFileInput(Constants.WALLET_KEY_BACKUP_BASE58));
    final File file=new File(getDir("String_Node_Str",Context.MODE_WORLD_READABLE | Context.MODE_WORLD_WRITEABLE),Constants.BLOCKCHAIN_FILENAME);
    file.delete();
    Toast.makeText(this,R.string.toast_wallet_reset,Toast.LENGTH_LONG).show();
    System.out.println("String_Node_Str" + Constants.WALLET_KEY_BACKUP_BASE58 + "String_Node_Str");
    return wallet;
  }
 catch (  final IOException x) {
    throw new RuntimeException(x);
  }
}
Program: 124533
Project: 124533
Buggy source:
private Wallet restoreWalletFromSnapshot() throws FileNotFoundException {
  try {
    final Wallet wallet=readKeys(getAssets().open(Constants.WALLET_KEY_BACKUP_SNAPSHOT));
    System.out.println("String_Node_Str");
    return wallet;
  }
 catch (  final FileNotFoundException x) {
    throw x;
  }
catch (  final IOException x) {
    throw new RuntimeException(x);
  }
}

Fixed version (ground truth):
private Wallet restoreWalletFromSnapshot() throws FileNotFoundException {
  try {
    final Wallet wallet=readKeys(getAssets().open(Constants.WALLET_KEY_BACKUP_SNAPSHOT));
    System.out.println("String_Node_Str" + Constants.WALLET_KEY_BACKUP_SNAPSHOT + "String_Node_Str");
    return wallet;
  }
 catch (  final FileNotFoundException x) {
    throw x;
  }
catch (  final IOException x) {
    throw new RuntimeException(x);
  }
}
Program: 124534
Project: 124534
Buggy source:
/** 
 * Returns the time at which the block was solved and broadcast, according to the clock of the solving node. 
 */
public long getTime(){
  return time;
}

Fixed version (ground truth):
/** 
 * Returns the time in seconds at which the block was solved and broadcast, according to the clock of the solving node. 
 */
public long getTime(){
  return time;
}
Program: 124535
Project: 124535
Buggy source:
public int getMaxConnections(){
  return maxConnections;
}

Fixed version (ground truth):
public int getMaxConnections(){
  return peerPool.getMaximumPoolSize();
}
Program: 124536
Project: 124536
Buggy source:
/** 
 * Create a PeerGroup
 */
public PeerGroup(BlockStore blockStore,NetworkParameters params,BlockChain chain,Wallet wallet,final PeerConnectionListener peerConnectionListener){
  this.maxConnections=DEFAULT_CONNECTIONS;
  this.blockStore=blockStore;
  this.params=params;
  this.chain=chain;
  this.wallet=wallet;
  this.peerConnectionListener=peerConnectionListener;
  inactives=new LinkedBlockingQueue<PeerAddress>();
  peers=Collections.synchronizedSet(new HashSet<Peer>());
  peerPool=new ThreadPoolExecutor(CORE_THREADS,this.maxConnections,THREAD_KEEP_ALIVE_SECONDS,TimeUnit.SECONDS,new LinkedBlockingQueue<Runnable>(1),new PeerGroupThreadFactory());
}

Fixed version (ground truth):
/** 
 * Create a PeerGroup
 */
public PeerGroup(BlockStore blockStore,NetworkParameters params,BlockChain chain,Wallet wallet,final PeerConnectionListener peerConnectionListener){
  this.blockStore=blockStore;
  this.params=params;
  this.chain=chain;
  this.wallet=wallet;
  this.peerConnectionListener=peerConnectionListener;
  inactives=new LinkedBlockingQueue<PeerAddress>();
  peers=Collections.synchronizedSet(new HashSet<Peer>());
  peerPool=new ThreadPoolExecutor(CORE_THREADS,DEFAULT_CONNECTIONS,THREAD_KEEP_ALIVE_SECONDS,TimeUnit.SECONDS,new LinkedBlockingQueue<Runnable>(1),new PeerGroupThreadFactory());
}
Program: 124537
Project: 124537
Buggy source:
/** 
 * Depending on the environment, this should normally be between 1 and 10, default is 4.
 * @param maxConnections the maximum number of peer connections that this group will try to make.
 */
public void setMaxConnections(int maxConnections){
  this.maxConnections=maxConnections;
  peerPool.setMaximumPoolSize(maxConnections);
}

Fixed version (ground truth):
/** 
 * Depending on the environment, this should normally be between 1 and 10, default is 4.
 * @param maxConnections the maximum number of peer connections that this group will try to make.
 */
public void setMaxConnections(int maxConnections){
  peerPool.setMaximumPoolSize(maxConnections);
}
Program: 124538
Project: 124538
Buggy source:
/** 
 * Start downloading the blockchain from the first available peer. <p>If no peers are currently connected, the download will be started once a peer starts.  If the peer dies, the download will resume with another peer.
 * @param listener a listener for chain download events, may not be null
 */
public synchronized void startBlockChainDownload(PeerEventListener listener){
  this.downloadListener=listener;
  if (!peers.isEmpty()) {
synchronized (peers) {
      startBlockChainDownloadFromPeer(peers.iterator().next());
    }
  }
}

Fixed version (ground truth):
/** 
 * Start downloading the blockchain from the first available peer. <p>If no peers are currently connected, the download will be started once a peer starts.  If the peer dies, the download will resume with another peer.
 * @param listener a listener for chain download events, may not be null
 */
public synchronized void startBlockChainDownload(PeerEventListener listener){
  this.downloadListener=listener;
synchronized (peers) {
    if (!peers.isEmpty()) {
      startBlockChainDownloadFromPeer(peers.iterator().next());
    }
  }
}
Program: 124539
Project: 124539
Buggy source:
protected synchronized void handlePeerDeath(Peer peer){
  if (peer == downloadPeer) {
    downloadPeer=null;
    if (downloadListener != null && !peers.isEmpty()) {
synchronized (peers) {
        startBlockChainDownloadFromPeer(peers.iterator().next());
      }
    }
  }
}

Fixed version (ground truth):
protected synchronized void handlePeerDeath(Peer peer){
  if (peer == downloadPeer) {
    downloadPeer=null;
synchronized (peers) {
      if (downloadListener != null && !peers.isEmpty()) {
        startBlockChainDownloadFromPeer(peers.iterator().next());
      }
    }
  }
}
Program: 124540
Project: 124540
Buggy source:
@Override public void execute() throws IOException {
  checkMCA();
  try {
    AccountUser user=new AccountUser();
    user.setAdmin(true);
    user.setEmailAddress(config.getEmailAddress());
    List<AccountUser> users=new ArrayList<AccountUser>();
    users.add(user);
    Account account=new Account();
    account.setName(AccountUtils.SAMPLE_ACCOUNT_NAME);
    account.setUsers(users);
    System.out.println("String_Node_Str");
    Account result=content.accounts().insert(config.getMerchantId(),account).execute();
    AccountUtils.printAccount(result);
  }
 catch (  GoogleJsonResponseException e) {
    checkGoogleJsonResponseException(e);
  }
}

Fixed version (ground truth):
@Override public void execute() throws IOException {
  checkMCA();
  try {
    Account account=new Account();
    account.setName(AccountUtils.SAMPLE_ACCOUNT_NAME);
    System.out.println("String_Node_Str");
    Account result=content.accounts().insert(config.getMerchantId(),account).execute();
    AccountUtils.printAccount(result);
  }
 catch (  GoogleJsonResponseException e) {
    checkGoogleJsonResponseException(e);
  }
}
Program: 124541
Project: 124541
Buggy source:
/** 
 * Main entry method.
 * @param args the application arguments
 */
public static void main(String[] args) throws Exception {
  System.out.println("String_Node_Str" + Arrays.toString(args));
  Arguments arguments=loadArguments(args);
  if (arguments == null) {
    return;
  }
  initializeLogging(arguments);
  application=new Application(arguments).start();
  registerShutdownHook();
  while (application.isRunning()) {
    Thread.sleep(500);
  }
}

Fixed version (ground truth):
/** 
 * Main entry method.
 * @param args the application arguments
 */
public static void main(String[] args) throws Exception {
  System.out.println("String_Node_Str" + Arrays.toString(args));
  Arguments arguments=loadArguments(args);
  if (arguments == null) {
    return;
  }
  initializeLogging(arguments);
  application=new Application(arguments);
  application.start();
  registerShutdownHook();
  while (application.isRunning()) {
    Thread.sleep(500);
  }
}
Program: 124542
Project: 124542
Buggy source:
/** 
 * Get combined static and dynamic metadata
 * @return Map of all metadata
 */
public Map<String,String> getMetadataMap(){
  Map<String,String> dynamic=getDynamicMetadataMap();
  if (dynamic == null) {
    return staticMetaDataCache;
  }
  LinkedHashMap<String,String> metadata=new LinkedHashMap<>(getStaticMetadataMap());
  metadata.putAll(dynamic);
  return metadata;
}

Fixed version (ground truth):
/** 
 * Get combined static and dynamic metadata
 * @return Map of all metadata
 */
public Map<String,String> getMetadataMap(){
  Map<String,String> dynamic=getDynamicMetadataMap();
  if (dynamic == null) {
    return getStaticMetadataMap();
  }
  LinkedHashMap<String,String> metadata=new LinkedHashMap<>(getStaticMetadataMap());
  metadata.putAll(dynamic);
  return metadata;
}
Program: 124543
Project: 124543
Buggy source:
@Override public void onApplicationEvent(ContextRefreshedEvent event){
  logger.debug("String_Node_Str",event);
  if (event.getSource().equals(getBootstrapApplicationContext())) {
    appMetadata=bootstrapApplicationContext.getBean(AppMetadata.class);
    configuration=bootstrapApplicationContext.getBean(AbstractConfiguration.class);
    configurationProvider=bootstrapApplicationContext.getBean(ConfigurationProvider.class);
    logger.debug("String_Node_Str");
    initClientApplication();
    return;
  }
  if (event.getSource() instanceof ApplicationContext && ((ApplicationContext)event.getSource()).getId().equals(appMetadata.getName())) {
    this.applicationContext=(AbstractApplicationContext)event.getSource();
    logger.debug("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void onApplicationEvent(ContextRefreshedEvent event){
  logger.debug("String_Node_Str",event);
  if (event.getSource().equals(getBootstrapApplicationContext())) {
    appMetadata=bootstrapApplicationContext.getBean(AppMetadata.class);
    configuration=bootstrapApplicationContext.getBean(AbstractConfiguration.class);
    configurationProvider=bootstrapApplicationContext.getBean(ConfigurationProvider.class);
    serverInstanceContext=bootstrapApplicationContext.getBean(ServerInstanceContext.class);
    logger.debug("String_Node_Str");
    initClientApplication();
    return;
  }
  if (event.getSource() instanceof ApplicationContext && ((ApplicationContext)event.getSource()).getId().equals(appMetadata.getName())) {
    this.applicationContext=(AbstractApplicationContext)event.getSource();
    logger.debug("String_Node_Str");
  }
}
Program: 124544
Project: 124544
Buggy source:
@Bean public AbstractConfiguration applicationConfiguration() throws ClassNotFoundException {
  AppMetadata appMetadata=appMetadata();
  ServerInstanceContext serverInstanceContext=serverInstanceContext();
  if (appEnvironment == null && serverInstanceContext != null) {
    appEnvironment=serverInstanceContext.getEnvironment();
  }
  ConfigurationBuilder configurationBuilder=new ConfigurationBuilder(appMetadata.getName(),appEnvironment,addSystemConfigs,reflections());
  configurationBuilder.withConfigurationProvider(configurationProvider());
  configurationBuilder.withServerInstanceContext(serverInstanceContext());
  configurationBuilder.withApplicationProperties(appMetadata.getPropertiesResourceLocation());
  configurationBuilder.withScanModuleConfigurations(scanModuleConfigurations);
  return configurationBuilder.build();
}

Fixed version (ground truth):
@Bean public AbstractConfiguration applicationConfiguration() throws ClassNotFoundException {
  AppMetadata appMetadata=appMetadata();
  ServerInstanceContext serverInstanceContext=serverInstanceContext();
  if (appEnvironment == null && serverInstanceContext != null) {
    appEnvironment=serverInstanceContext.getEnvironment();
  }
  ConfigurationBuilder configurationBuilder=new ConfigurationBuilder(appMetadata.getName(),appEnvironment,addSystemConfigs,reflections());
  configurationBuilder.withConfigurationProvider(configurationProvider());
  configurationBuilder.withServerInstanceContext(serverInstanceContext());
  configurationBuilder.withApplicationProperties(appMetadata.getPropertiesResourceLocation());
  configurationBuilder.withScanModuleConfigurations(scanModuleConfigurations);
  configurationBuilder.withAppVersion(appMetadata.getDeclaringClass().getPackage().getImplementationVersion());
  AbstractConfiguration configuration=configurationBuilder.build();
  if (serverInstanceContext != null) {
    serverInstanceContext.setAppName(appMetadata.getName());
    serverInstanceContext.setVersion(configuration.getString(BootstrapConfigKeys.APP_VERSION_KEY.getPropertyName()));
    serverInstanceContext.tagInstance();
  }
  return configuration;
}
Program: 124545
Project: 124545
Buggy source:
public void tagInstance(String tagInstanceName){
  Preconditions.checkArgument(StringUtils.isNotBlank(appName),"String_Node_Str");
  Preconditions.checkArgument(StringUtils.isNotBlank(environment),"String_Node_Str");
  Preconditions.checkArgument(StringUtils.isNotBlank(version),"String_Node_Str");
  Tag nameTag=new Tag().withKey("String_Node_Str").withValue(tagInstanceName);
  Tag appTag=new Tag().withKey("String_Node_Str").withValue(appName);
  Tag envTag=new Tag().withKey("String_Node_Str").withValue(environment);
  Tag versionTag=new Tag().withKey("String_Node_Str").withValue(version);
  AwsUtils.tagInstance(instanceId,amazonEC2,nameTag,appTag,envTag,versionTag);
}

Fixed version (ground truth):
public void tagInstance(){
  Preconditions.checkArgument(StringUtils.isNotBlank(appName),"String_Node_Str");
  Preconditions.checkArgument(StringUtils.isNotBlank(environment),"String_Node_Str");
  Preconditions.checkArgument(StringUtils.isNotBlank(version),"String_Node_Str");
  String tagName=Joiner.on("String_Node_Str").join(environment,appName,version);
  Tag nameTag=new Tag().withKey("String_Node_Str").withValue(tagName);
  Tag appTag=new Tag().withKey("String_Node_Str").withValue(appName);
  Tag envTag=new Tag().withKey("String_Node_Str").withValue(environment);
  Tag versionTag=new Tag().withKey("String_Node_Str").withValue(version);
  AwsUtils.tagInstance(instanceId,amazonEC2,nameTag,appTag,envTag,versionTag);
}
Program: 124546
Project: 124546
Buggy source:
private void initAppVersion(){
  if (applicationFileConfiguration == null) {
    throw new BootstrapException("String_Node_Str");
  }
  if (appVersion == null) {
    if (System.getProperty(BootstrapConfigKeys.APP_VERSION_KEY.getPropertyName()) != null) {
      this.appVersion=System.getProperty(BootstrapConfigKeys.APP_VERSION_KEY.getPropertyName());
      return;
    }
    if (applicationFileConfiguration != null && applicationFileConfiguration.containsKey(BootstrapConfigKeys.APP_VERSION_KEY.getPropertyName())) {
      System.setProperty(BootstrapConfigKeys.APP_VERSION_KEY.getPropertyName(),applicationFileConfiguration.getString(BootstrapConfigKeys.APP_VERSION_KEY.getPropertyName()));
    }
  }
  if (applicationFileConfiguration.containsKey(BootstrapConfigKeys.APP_VERSION_KEY.getPropertyName())) {
    this.appVersion=applicationFileConfiguration.getString(BootstrapConfigKeys.APP_VERSION_KEY.getPropertyName());
  }
  checkAppVersion();
}

Fixed version (ground truth):
private void initAppVersion(){
  if (appVersion == null) {
    appVersion=System.getProperty(BootstrapConfigKeys.APP_VERSION_KEY.getPropertyName(),null);
    if (appVersion == null && applicationFileConfiguration != null) {
      appVersion=applicationFileConfiguration.getString(BootstrapConfigKeys.APP_VERSION_KEY.getPropertyName(),null);
    }
  }
  if (StringUtils.isBlank(appVersion)) {
    BootstrapException.missingApplicationVersion();
  }
  System.setProperty(BootstrapConfigKeys.APP_VERSION_KEY.getPropertyName(),appVersion);
}