Browse Source

Use List#isEmpty() in DispatcherServlet

This commit uses !isEmpty() instead of size() > 0.

Closes gh-31244
pull/27229/head
shin-mallang 1 year ago committed by Sam Brannen
parent
commit
3932f91117
  1. 2
      spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java

2
spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java

@ -1018,7 +1018,7 @@ public class DispatcherServlet extends FrameworkServlet { @@ -1018,7 +1018,7 @@ public class DispatcherServlet extends FrameworkServlet {
if (traceOn) {
List<String> values = Collections.list(request.getHeaderNames());
String headers = values.size() > 0 ? "masked" : "";
String headers = values.isEmpty() ? "" : "masked";
if (isEnableLoggingRequestDetails()) {
headers = values.stream().map(name -> name + ":" + Collections.list(request.getHeaders(name)))
.collect(Collectors.joining(", "));

Loading…
Cancel
Save