Преглед на файлове

Readability Polish

Heavily nested parentheses and lots of indentation can get hard to
read, so we should simplify this where we can.

Issue: gh-6639
Josh Cummings преди 6 години
родител
ревизия
2daed8c003
променени са 1 файла, в които са добавени 4 реда и са изтрити 3 реда
  1. 4 3
      web/src/main/java/org/springframework/security/web/server/transport/HttpsRedirectWebFilter.java

+ 4 - 3
web/src/main/java/org/springframework/security/web/server/transport/HttpsRedirectWebFilter.java

@@ -102,9 +102,10 @@ public final class HttpsRedirectWebFilter implements WebFilter {
 				UriComponentsBuilder.fromUri(exchange.getRequest().getURI());
 
 		if (port > 0) {
-			builder.port(Optional.ofNullable(this.portMapper.lookupHttpsPort(port))
-									.orElseThrow(() -> new IllegalStateException(
-										"HTTP Port '" + port + "' does not have a corresponding HTTPS Port")));
+			Optional.ofNullable(this.portMapper.lookupHttpsPort(port))
+					.map(builder::port)
+					.orElseThrow(() -> new IllegalStateException(
+							"HTTP Port '" + port + "' does not have a corresponding HTTPS Port"));
 		}
 
 		return builder.scheme("https").build().toUri();