Program: 68995
Project: 68995
Buggy source:
@RequestMapping(value="String_Node_Str",method=POST,consumes=APPLICATION_JSON_UTF8_VALUE,produces=APPLICATION_JSON_UTF8_VALUE) public AddressResponse address(@Valid @RequestBody AddressRequest addressRequest,@RequestHeader(value="String_Node_Str") String authorizationHeader) throws AddressException {
  String emailConfirmationToken=getEmailConfirmationToken(authorizationHeader);
  Optional<Investor> oInvestor=investorRepository.findOptionalByEmailConfirmationToken(emailConfirmationToken);
  if (!oInvestor.isPresent()) {
    throw new EmailConfirmationTokenNotFoundException();
  }
  String walletAddress=addressRequest.getAddress();
  String refundBitcoinAddress=addressRequest.getRefundBTC();
  String refundEthereumAddress=addressRequest.getRefundETH();
  Keys bitcoinKeys=bitcoinKeyGenerator.getKeys();
  Keys ethereumKeys=ethereumKeyGenerator.getKeys();
  try {
    Investor investor=oInvestor.get();
    investor.setWalletAddress(walletAddress).setPayInBitcoinAddress(bitcoinKeys.getAddressBase16()).setPayInBitcoinPrivateKey(bitcoinKeys.getPrivateKeyBase16()).setPayInEtherAddress(ethereumKeys.getAddressBase16()).setPayInEtherPrivateKey(ethereumKeys.getPrivateKeyBase16()).setRefundBitcoinAddress(refundBitcoinAddress).setRefundEtherAddress(refundEthereumAddress);
    investorRepository.save(investor);
  }
 catch (  Exception e) {
    throw new AddressException();
  }
  return new AddressResponse().setBtc(bitcoinKeys.getAddressBase16()).setEther(ethereumKeys.getAddressBase16());
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=POST,consumes=APPLICATION_JSON_UTF8_VALUE,produces=APPLICATION_JSON_UTF8_VALUE) public AddressResponse address(@Valid @RequestBody AddressRequest addressRequest,@RequestHeader(value="String_Node_Str") String authorizationHeader) throws AddressException {
  String emailConfirmationToken=getEmailConfirmationToken(authorizationHeader);
  Optional<Investor> oInvestor=investorRepository.findOptionalByEmailConfirmationToken(emailConfirmationToken);
  if (!oInvestor.isPresent()) {
    throw new EmailConfirmationTokenNotFoundException();
  }
  String walletAddress=replacePrefixAddress(addressRequest.getAddress());
  String refundEthereumAddress=replacePrefixAddress(addressRequest.getRefundETH());
  String refundBitcoinAddress=addressRequest.getRefundBTC();
  if (!ethereumKeyGenerator.isValidAddress(walletAddress) || !ethereumKeyGenerator.isValidAddress(refundEthereumAddress)) {
    throw new EthereumAddressInvalidException();
  }
  if (!bitcoinKeyGenerator.isValidAddress(refundBitcoinAddress)) {
    throw new BitcoinAddressInvalidException();
  }
  Keys bitcoinKeys=bitcoinKeyGenerator.getKeys();
  Keys ethereumKeys=ethereumKeyGenerator.getKeys();
  try {
    Investor investor=oInvestor.get();
    investor.setWalletAddress(walletAddress).setPayInBitcoinAddress(bitcoinKeys.getAddressAsString()).setPayInBitcoinPrivateKey(Hex.toHexString(bitcoinKeys.getPrivateKey())).setPayInEtherAddress(ethereumKeys.getAddressAsString()).setPayInEtherPrivateKey(Hex.toHexString(ethereumKeys.getPrivateKey())).setRefundBitcoinAddress(refundBitcoinAddress).setRefundEtherAddress(refundEthereumAddress);
    investorRepository.save(investor);
  }
 catch (  Exception e) {
    throw new AddressException();
  }
  return new AddressResponse().setBtc(bitcoinKeys.getAddressAsString()).setEther(ethereumKeys.getAddressAsString());
}