Skip to content

Commit

Permalink
java8 optional method
Browse files Browse the repository at this point in the history
  • Loading branch information
apucher committed Jan 28, 2022
1 parent 1148538 commit 29e4860
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private static int getPort(String configuredPort) {
private static String getProtocol(String configuredProtocol, String listenerName) {
Optional<String> optProtocol =
Optional.ofNullable(configuredProtocol).map(String::trim).filter(protocol -> !protocol.isEmpty());
if (optProtocol.isEmpty()) {
if (!optProtocol.isPresent()) {
return Optional.of(listenerName).filter(SUPPORTED_PROTOCOLS::contains).orElseThrow(
() -> new IllegalArgumentException("No protocol set for listener" + listenerName + " and '" + listenerName
+ "' is not a valid protocol either"));
Expand Down

0 comments on commit 29e4860

Please sign in to comment.