Skip to content

Commit

Permalink
fix review: Locale nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgeniiMunin committed Jan 7, 2025
1 parent 3aaeb7a commit f269b75
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,9 @@ private List<ThrottlingMessage> extractMessagesForImp(
}

private static String getCountryNameFromAlpha2(String isoCode) {
return Optional.ofNullable(isoCode)
.filter(code -> !code.isBlank())
.map(code -> new Locale(StringUtils.EMPTY, code))
.map(Locale::getDisplayCountry)
.orElse(StringUtils.EMPTY);
return StringUtils.isBlank(isoCode)
? StringUtils.EMPTY
: new Locale(StringUtils.EMPTY, isoCode).getDisplayCountry();
}

private String getCountry(String ip) {
Expand Down

0 comments on commit f269b75

Please sign in to comment.