From 3932f91117aad8afa082bab63ed7cc44f7c01b70 Mon Sep 17 00:00:00 2001 From: shin-mallang Date: Sat, 16 Sep 2023 04:33:23 +0900 Subject: [PATCH] Use List#isEmpty() in DispatcherServlet This commit uses !isEmpty() instead of size() > 0. Closes gh-31244 --- .../java/org/springframework/web/servlet/DispatcherServlet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java index 729f050d542c..3151ed583b32 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java @@ -1018,7 +1018,7 @@ else if (isEnableLoggingRequestDetails()) { if (traceOn) { List 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(", "));