Source:
public void generateDistributionOfIncomeDocumentsFromAWSService() { String startMessageBase = configurationService.getPropertyValueAsString(CuFPKeyConstants.MESSAGE_AWS_BILLING_JOB_START_MESSAGE); LOG.info("generateDistributionOfIncomeDocumentsFromAWSService, " + MessageFormat.format(startMessageBase, findProcessYear(), findMonthName(), findStartDate(), findEndDate())); CloudCheckrWrapper cloudCheckrWrapper = null; DefaultKfsAccountForAwsResultWrapper defaultAccountWrapper = null; AmazonBillResultsDTO resultsDTO = new AmazonBillResultsDTO(); boolean success = true; try { cloudCheckrWrapper = cloudcheckrService.getCloudCheckrWrapper(findStartDate(), findEndDate()); defaultAccountWrapper = cloudcheckrService.getDefaultKfsAccountForAwsResultWrapper(); } catch (URISyntaxException | IOException exception) { LOG.error("unable to call cloud checker service", exception); success = false; } if (ObjectUtils.isNotNull(cloudCheckrWrapper) && ObjectUtils.isNotNull(defaultAccountWrapper)) { AccountingXmlDocumentListWrapper documentWrapper = buildAccountingXmlDocumentListWrapper(cloudCheckrWrapper, defaultAccountWrapper, resultsDTO); LOG.info("generateDistributionOfIncomeDocumentsFromAWSService, built documentWrapper: " + documentWrapper); success &= generateXML(documentWrapper); } else { success = false; LOG.error("generateDistributionOfIncomeDocumentsFromAWSService, cloudCheckrWrapper or defaultAccountWrapper was not built, can not generate DIs"); } logResults(resultsDTO); resetProperties(); if (!success) { throw new RuntimeException("There was a problem with Amazon Billing Service"); } }

Target:
public void generateDistributionOfIncomeDocumentsFromAWSService() { String startMessageBase = configurationService.getPropertyValueAsString(CuFPKeyConstants.MESSAGE_AWS_BILLING_JOB_START_MESSAGE); boolean totalJobSuccess = true; LOG.info("generateDistributionOfIncomeDocumentsFromAWSService, " + MessageFormat.format(startMessageBase, findProcessYear(), findMonthName(), findStartDate(), findEndDate())); DefaultKfsAccountForAwsResultWrapper defaultAccountWrapper = null; List<AmazonBillResultsDTO> resultsDTOs = new ArrayList<AmazonBillResultsDTO>(); try { defaultAccountWrapper = cloudCheckrService.getDefaultKfsAccountForAwsResultWrapper(); if (LOG.isDebugEnabled()) { LOG.info("generateDistributionOfIncomeDocumentsFromAWSService, defaultAccountWrapper: " + defaultAccountWrapper.toString()); } } catch (URISyntaxException | IOException e) { LOG.error("generateDistributionOfIncomeDocumentsFromAWSService, Unable to call default account service.", e); totalJobSuccess = false; } Map<String, String> masterAccountMap = buildMasterAccountMap(); if (ObjectUtils.isNotNull(defaultAccountWrapper)) { for (String masterAccountNumber : masterAccountMap.keySet()) { String masterAccountName = masterAccountMap.get(masterAccountNumber); AmazonBillResultsDTO resultsDTO = processRootAccount(masterAccountNumber, masterAccountName, defaultAccountWrapper); totalJobSuccess &= resultsDTO.successfullyProcessed; resultsDTOs.add(resultsDTO); } } resultsDTOs.stream().forEach(AmazonBillResultsDTO::logResults); if (!totalJobSuccess) { sendErrorEmailForFailedAccounts(resultsDTOs); throw new RuntimeException("There was a problem with Amazon Billing Service"); } }