From dfd1e09e0c5fb6d968f45888ca195c3816f5ac65 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 1 Oct 2021 08:35:29 +1000 Subject: [PATCH] replaced `==` tests on `Boolean`s with `equals` Signed-off-by: Greg Wilkins --- .../src/main/java/org/eclipse/jetty/http/HttpGenerator.java | 2 +- .../src/main/java/org/eclipse/jetty/http/HttpURI.java | 2 +- .../main/java/org/eclipse/jetty/util/IncludeExcludeSet.java | 4 ++-- .../java/org/eclipse/jetty/webapp/ClasspathPattern.java | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpGenerator.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpGenerator.java index bfd958d180ef..326c35338665 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpGenerator.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpGenerator.java @@ -670,7 +670,7 @@ else if (contentLength != field.getLongValue()) close = true; _persistent = false; } - if (keepAlive && _persistent == Boolean.FALSE) + if (keepAlive && Boolean.FALSE.equals(_persistent)) { field = new HttpField(HttpHeader.CONNECTION, Stream.of(field.getValues()).filter(s -> !HttpHeaderValue.KEEP_ALIVE.is(s)) diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java index 3dc76024d46f..02cbe08192c4 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java @@ -785,7 +785,7 @@ private void checkSegment(String uri, int segment, int end, boolean param) if (ambiguous != null) { // Is the segment intrinsically ambiguous - if (ambiguous == Boolean.TRUE) + if (Boolean.TRUE.equals(ambiguous)) _violations.add(Violation.SEGMENT); // Is the segment ambiguous with a parameter? if (param) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/IncludeExcludeSet.java b/jetty-util/src/main/java/org/eclipse/jetty/util/IncludeExcludeSet.java index c54d08619d4a..164ea02574c4 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/IncludeExcludeSet.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/IncludeExcludeSet.java @@ -259,12 +259,12 @@ public static boolean matchCombined(T1 item1, IncludeExcludeSet Boolean match2 = set2.isIncludedAndNotExcluded(item2); // if we are excluded from either set, then we do not match - if (match1 == Boolean.FALSE || match2 == Boolean.FALSE) + if (Boolean.FALSE.equals(match1) || Boolean.FALSE.equals(match2)) return false; // If either set has any includes, then we must be included by one of them if (set1.hasIncludes() || set2.hasIncludes()) - return match1 == Boolean.TRUE || match2 == Boolean.TRUE; + return Boolean.TRUE.equals(match1) || Boolean.TRUE.equals(match2); // If not excluded and no includes, then we match return true; diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/ClasspathPattern.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/ClasspathPattern.java index 160181b06b73..64571ec2a22d 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/ClasspathPattern.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/ClasspathPattern.java @@ -742,7 +742,7 @@ static boolean combine(IncludeExcludeSet names, String name, Incl Boolean byName = names.isIncludedAndNotExcluded(name); // If we excluded by name, then no match - if (Boolean.FALSE == byName) + if (Boolean.FALSE.equals(byName)) return false; // check the location set @@ -750,12 +750,12 @@ static boolean combine(IncludeExcludeSet names, String name, Incl Boolean byLocation = uri == null ? null : locations.isIncludedAndNotExcluded(uri); // If we excluded by location or couldn't check location exclusion, then no match - if (Boolean.FALSE == byLocation || (locations.hasExcludes() && uri == null)) + if (Boolean.FALSE.equals(byLocation) || (locations.hasExcludes() && uri == null)) return false; // If there are includes, then we must be included to match. if (names.hasIncludes() || locations.hasIncludes()) - return byName == Boolean.TRUE || byLocation == Boolean.TRUE; + return Boolean.TRUE.equals(byName) || Boolean.TRUE.equals(byLocation); // Otherwise there are no includes and it was not excluded, so match return true;