Skip to content

Commit

Permalink
Fixed Sonar report on using Optional w/o checking isPresent or !isEmp…
Browse files Browse the repository at this point in the history
…ty()

Issue: #3218
  • Loading branch information
buchen committed Mar 13, 2023
1 parent c048342 commit 289d0a2
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public QuoteFeedData getHistoricalQuotes(Security security, boolean collectRawRe
// 100
BigDecimal alignFactor = new BigDecimal(100).multiply(Values.Quote.getBigDecimalFactor()).divide(eoniaPrices.stream()
.filter(pair -> pair.getLeft().isAfter(LocalDate.of(2019, 10, 01).minusDays(1)))
.findFirst().get().getRight(), 20, RoundingMode.HALF_EVEN);
.findFirst().orElseThrow().getRight(), 20, RoundingMode.HALF_EVEN);
List<LatestSecurityPrice> pricesToAdd = eoniaPrices.stream()
.filter(pair -> pair.getLeft().isBefore(LocalDate.of(2019, 10, 01)))
.map(pair -> new Pair<>(pair.getLeft(), pair.getRight().multiply(alignFactor)))
Expand Down Expand Up @@ -364,7 +364,7 @@ private ExtractedData extractData(String responseBody)
if (!interestRateString.equals("NaN")) //$NON-NLS-1$
{
BigDecimal interestRate = new BigDecimal(interestRateString);
dataSeries.add(new Pair<LocalDate, BigDecimal>(date, interestRate));
dataSeries.add(new Pair<>(date, interestRate));
}
}

Expand All @@ -375,7 +375,7 @@ private ExtractedData extractData(String responseBody)
// EONIA is an over-night index, so it has modified duration 0 and
// we can calculate the quote for one
// more day given the current interest rate.
dataSeries.add(new Pair<LocalDate, BigDecimal>(lastQuoteDate, new BigDecimal(0)));
dataSeries.add(new Pair<>(lastQuoteDate, new BigDecimal(0)));
}
ExtractedData extractedData = new ExtractedData();
extractedData.dataSeries = dataSeries;
Expand Down

0 comments on commit 289d0a2

Please sign in to comment.