Program: 40484
Project: 40484
Buggy source:
@PostMapping("String_Node_Str") public EthTransferContractView createEthTransaction(@RequestParam("String_Node_Str") String returnArkAddress,@RequestParam("String_Node_Str") String recipientEthAddress,@RequestParam("String_Node_Str") String ethAmountStr){
  BigDecimal ethAmount=new BigDecimal(ethAmountStr).setScale(8,BigDecimal.ROUND_HALF_UP);
  BigDecimal arkPerEthExchangeRate=exchangeRateService.getRate("String_Node_Str","String_Node_Str");
  BigDecimal baseArkCost=ethAmount.multiply(arkPerEthExchangeRate);
  BigDecimal arkFeeTotal=baseArkCost.multiply(arkFeePercent.divide(new BigDecimal("String_Node_Str"),BigDecimal.ROUND_UP).add(arkFlatFee)).add(arkTransactionFee);
  BigDecimal requiredArkCost=baseArkCost.add(arkFeeTotal);
  EthTransferContractEntity entity=new EthTransferContractEntity();
  entity.setToken(UUID.randomUUID().toString());
  entity.setCreatedAt(ZonedDateTime.from(Instant.now().atOffset(ZoneOffset.UTC)));
  entity.setStatus(EthTransferContractEntity.STATUS_PENDING);
  entity.setServiceArkAddress(serviceArkAddress);
  entity.setArkFlatFee(arkFlatFee);
  entity.setArkFeePercent(arkFeePercent);
  entity.setArkFeeTotal(arkFeeTotal);
  entity.setRequiredArkAmount(requiredArkCost.setScale(8,BigDecimal.ROUND_UP));
  entity.setReturnArkAddress(returnArkAddress);
  entity.setRecipientEthAddress(recipientEthAddress);
  entity.setEthAmount(ethAmount);
  entity.setArkPerEthExchangeRate(arkPerEthExchangeRate.setScale(8,BigDecimal.ROUND_UP));
  ethTransferContractRepository.save(entity);
  CreateMessageRequest createMessageRequest=new CreateMessageRequest();
  createMessageRequest.setCallbackUrl("String_Node_Str");
  createMessageRequest.setToken(entity.getToken());
  listenerRestTemplate.postForObject("String_Node_Str",createMessageRequest,Void.class);
  return ethTransferContractViewMapper.map(entity);
}

Fixed version (ground truth):
@PostMapping("String_Node_Str") public EthTransferContractView createEthTransaction(@RequestParam("String_Node_Str") String returnArkAddress,@RequestParam("String_Node_Str") String recipientEthAddress,@RequestParam("String_Node_Str") String ethAmountStr){
  BigDecimal ethAmount=new BigDecimal(ethAmountStr).setScale(8,BigDecimal.ROUND_HALF_UP);
  BigDecimal arkPerEthExchangeRate=exchangeRateService.getRate("String_Node_Str","String_Node_Str");
  BigDecimal baseArkCost=ethAmount.multiply(arkPerEthExchangeRate);
  BigDecimal arkFeeTotal=baseArkCost.multiply(arkFeePercent.divide(new BigDecimal("String_Node_Str"),BigDecimal.ROUND_UP)).add(arkFlatFee).add(arkTransactionFee);
  BigDecimal requiredArkCost=baseArkCost.add(arkFeeTotal);
  EthTransferContractEntity entity=new EthTransferContractEntity();
  entity.setToken(UUID.randomUUID().toString());
  entity.setCreatedAt(ZonedDateTime.from(Instant.now().atOffset(ZoneOffset.UTC)));
  entity.setStatus(EthTransferContractEntity.STATUS_PENDING);
  entity.setServiceArkAddress(serviceArkAddress);
  entity.setArkFlatFee(arkFlatFee);
  entity.setArkFeePercent(arkFeePercent);
  entity.setArkFeeTotal(arkFeeTotal);
  entity.setRequiredArkAmount(requiredArkCost.setScale(8,BigDecimal.ROUND_UP));
  entity.setReturnArkAddress(returnArkAddress);
  entity.setRecipientEthAddress(recipientEthAddress);
  entity.setEthAmount(ethAmount);
  entity.setArkPerEthExchangeRate(arkPerEthExchangeRate.setScale(8,BigDecimal.ROUND_UP));
  ethTransferContractRepository.save(entity);
  CreateMessageRequest createMessageRequest=new CreateMessageRequest();
  createMessageRequest.setCallbackUrl("String_Node_Str");
  createMessageRequest.setToken(entity.getToken());
  listenerRestTemplate.postForObject("String_Node_Str",createMessageRequest,Void.class);
  return ethTransferContractViewMapper.map(entity);
}