From 020ebde77cb0a9cf4d943933c7fc2e213069c3ab Mon Sep 17 00:00:00 2001 From: Lachlan Roberts Date: Tue, 6 Mar 2018 14:28:11 +1100 Subject: [PATCH] found additional ReferenceEquality warnings which have been resolved Signed-off-by: Lachlan Roberts --- .../org/eclipse/jetty/client/HttpContent.java | 17 +++++++++++++++-- .../org/eclipse/jetty/client/HttpRequest.java | 5 ++++- .../jetty/client/http/HttpSenderOverHTTP.java | 4 ++-- .../client/HttpClientAuthenticationTest.java | 1 + .../jetty/deploy/DeploymentManager.java | 5 ++++- .../org/eclipse/jetty/deploy/graph/Edge.java | 18 +++++++++++++++++- .../org/eclipse/jetty/deploy/graph/Graph.java | 10 ++++++---- .../deploy/jmx/DeploymentManagerMBean.java | 2 +- .../client/http/HttpConnectionOverFCGI.java | 4 +++- .../eclipse/jetty/http/GZIPContentDecoder.java | 4 ++-- .../org/eclipse/jetty/http/HttpParserTest.java | 1 + .../jetty/http2/hpack/HpackContextTest.java | 1 + .../jetty/io/ArrayByteBufferPoolTest.java | 2 ++ .../jetty/rewrite/handler/ValidUrlRule.java | 2 +- .../eclipse/jetty/server/ResponseWriter.java | 5 ----- .../org/eclipse/jetty/servlets/DoSFilter.java | 6 +++--- .../org/eclipse/jetty/servlets/QoSFilter.java | 4 ++-- .../java/org/eclipse/jetty/start/Modules.java | 6 +++--- .../org/eclipse/jetty/util/BufferUtil.java | 11 +++++++++++ .../java/org/eclipse/jetty/util/Fields.java | 5 ++--- .../jetty/util/resource/FileResource.java | 5 ++--- .../org/eclipse/jetty/util/BufferUtilTest.java | 1 + .../org/eclipse/jetty/util/DateCacheTest.java | 1 + .../org/eclipse/jetty/util/StringUtilTest.java | 6 +++++- .../jetty/util/TopologicalSortTest.java | 1 + .../common/message/MessageInputStream.java | 9 ++++++++- ...actSessionInvalidateCreateScavengeTest.java | 1 + 27 files changed, 100 insertions(+), 37 deletions(-) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpContent.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpContent.java index 544bbadc23f..66b24cc677d 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpContent.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpContent.java @@ -81,6 +81,18 @@ public class HttpContent implements Callback, Closeable this.iterator = provider == null ? Collections.emptyIterator() : provider.iterator(); } + /** + * + * @param buffer + * @return whether the input buffer has been closed + */ + private static boolean isBufferClosed(ByteBuffer buffer) + { + @SuppressWarnings("ReferenceEquality") + boolean bufferClosed = (buffer == CLOSE); + return bufferClosed; + } + /** * @return whether there is any content at all */ @@ -177,6 +189,7 @@ public class HttpContent implements Callback, Closeable /** * @return whether the cursor has been advanced past the {@link #isLast() last} position. */ + @SuppressWarnings("ReferenceEquality") public boolean isConsumed() { return buffer == AFTER; @@ -187,7 +200,7 @@ public class HttpContent implements Callback, Closeable { if (isConsumed()) return; - if (buffer == CLOSE) + if (isBufferClosed(buffer)) return; if (iterator instanceof Callback) ((Callback)iterator).succeeded(); @@ -198,7 +211,7 @@ public class HttpContent implements Callback, Closeable { if (isConsumed()) return; - if (buffer == CLOSE) + if (isBufferClosed(buffer)) return; if (iterator instanceof Callback) ((Callback)iterator).failed(x); diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpRequest.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpRequest.java index be229cda4c9..7ae3fbb56d2 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpRequest.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpRequest.java @@ -204,7 +204,10 @@ public class HttpRequest implements Request { if (uri == null) uri = buildURI(true); - return uri == NULL_URI ? null : uri; + + @SuppressWarnings("ReferenceEquality") + boolean isNullURI = (uri == NULL_URI); + return isNullURI ? null : uri; } @Override diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpSenderOverHTTP.java b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpSenderOverHTTP.java index e80163c81b8..003d685f9c6 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpSenderOverHTTP.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpSenderOverHTTP.java @@ -321,10 +321,10 @@ public class HttpSenderOverHTTP extends HttpSender private void release() { ByteBufferPool bufferPool = httpClient.getByteBufferPool(); - if (headerBuffer != BufferUtil.EMPTY_BUFFER) + if (!BufferUtil.isTheEmptyBuffer(headerBuffer)) bufferPool.release(headerBuffer); headerBuffer = null; - if (chunkBuffer != BufferUtil.EMPTY_BUFFER) + if (!BufferUtil.isTheEmptyBuffer(chunkBuffer)) bufferPool.release(chunkBuffer); chunkBuffer = null; contentBuffer = null; diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientAuthenticationTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientAuthenticationTest.java index 96fd6cc27ec..3dd0d4a1c99 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientAuthenticationTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientAuthenticationTest.java @@ -589,6 +589,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest public ByteBuffer current; @Override + @SuppressWarnings("ReferenceEquality") public boolean hasNext() { if (current == null) diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/DeploymentManager.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/DeploymentManager.java index 5ace6c65ef6..48648c606c0 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/DeploymentManager.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/DeploymentManager.java @@ -26,6 +26,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; @@ -311,10 +312,12 @@ public class DeploymentManager extends ContainerLifeCycle */ public Collection getApps(Node node) { + Objects.requireNonNull(node); + List ret = new ArrayList<>(); for (AppEntry entry : _apps) { - if (entry.lifecyleNode == node) + if (node.equals(entry.lifecyleNode)) { ret.add(entry.app); } diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/graph/Edge.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/graph/Edge.java index 024e25c5a26..af792eedd66 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/graph/Edge.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/graph/Edge.java @@ -28,7 +28,9 @@ public final class Edge public Edge(Node from, Node to) { - if (from==null || to==null || from==to) + @SuppressWarnings("ReferenceEquality") + boolean sameObject = (from==to); + if (from==null || to==null || sameObject) throw new IllegalArgumentException("from "+from+" to "+to); _from = from; _to = to; @@ -71,12 +73,26 @@ public final class Edge { return _from; } + + public boolean isFromNode(Node node) + { + @SuppressWarnings("ReferenceEquality") + boolean isFromNode_ = (_from == node); + return isFromNode_; + } public Node getTo() { return _to; } + public boolean isToNode(Node node) + { + @SuppressWarnings("ReferenceEquality") + boolean isToNode_ = (_to == node); + return isToNode_; + } + @Override public String toString() { diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/graph/Graph.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/graph/Graph.java index c0aba65f542..b05064f7add 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/graph/Graph.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/graph/Graph.java @@ -40,7 +40,7 @@ public class Graph addNode(toNode=edge.getTo()); // replace edge with normalized edge - if (edge.getFrom()!=fromNode || edge.getTo()!=toNode) + if (!edge.isFromNode(fromNode) || !edge.isToNode(toNode)) edge=new Edge(fromNode,toNode); this._edges.add(edge); @@ -129,7 +129,7 @@ public class Graph for (Edge edge : this._edges) { - if ((edge.getFrom() == node) || (edge.getTo() == node)) + if (edge.isFromNode(node) || edge.isToNode(node)) { fromedges.add(edge); } @@ -151,7 +151,7 @@ public class Graph for (Edge edge : this._edges) { - if (edge.getFrom() == from) + if (edge.isFromNode(from)) { fromedges.add(edge); } @@ -192,7 +192,9 @@ public class Graph */ public Path getPath(Node from, Node to) { - if (from == to) + @SuppressWarnings("ReferenceEquality") + boolean sameObject = (from==to); + if (sameObject) { return new Path(); } diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/jmx/DeploymentManagerMBean.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/jmx/DeploymentManagerMBean.java index 3c0ea08de81..165d10a122a 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/jmx/DeploymentManagerMBean.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/jmx/DeploymentManagerMBean.java @@ -74,7 +74,7 @@ public class DeploymentManagerMBean extends ObjectMBean List ret = new ArrayList<>(); for (DeploymentManager.AppEntry entry : _manager.getAppEntries()) { - if (entry.getLifecyleNode() == node) + if (node.equals(entry.getLifecyleNode())) { ret.add(toRef(entry.getApp())); } diff --git a/jetty-fcgi/fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/http/HttpConnectionOverFCGI.java b/jetty-fcgi/fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/http/HttpConnectionOverFCGI.java index 1ff27d3583d..d72762f2d63 100644 --- a/jetty-fcgi/fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/http/HttpConnectionOverFCGI.java +++ b/jetty-fcgi/fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/http/HttpConnectionOverFCGI.java @@ -127,7 +127,9 @@ public class HttpConnectionOverFCGI extends AbstractConnection implements Connec private void releaseBuffer(ByteBuffer buffer) { - assert this.buffer == buffer; + @SuppressWarnings("ReferenceEquality") + boolean isCurrentBuffer = (this.buffer == buffer); + assert(isCurrentBuffer); HttpClient client = destination.getHttpClient(); ByteBufferPool bufferPool = client.getByteBufferPool(); bufferPool.release(buffer); diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/GZIPContentDecoder.java b/jetty-http/src/main/java/org/eclipse/jetty/http/GZIPContentDecoder.java index c4ce22f2013..e3e0401fbee 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/GZIPContentDecoder.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/GZIPContentDecoder.java @@ -418,8 +418,8 @@ public class GZIPContentDecoder implements Destroyable public void release(ByteBuffer buffer) { @SuppressWarnings("ReferenceEquality") - boolean isTheEmptyBuffer = (buffer!=BufferUtil.EMPTY_BUFFER); - if (_pool!=null && isTheEmptyBuffer) + boolean isTheEmptyBuffer = (buffer==BufferUtil.EMPTY_BUFFER); + if (_pool!=null && !isTheEmptyBuffer) _pool.release(buffer); } } diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java index 174ac6da23e..98e1f9a9044 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java @@ -2025,6 +2025,7 @@ public class HttpParserTest Assert.assertEquals(null, _bad); } @Test + @SuppressWarnings("ReferenceEquality") public void testCachedField() throws Exception { ByteBuffer buffer = BufferUtil.toBuffer( diff --git a/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackContextTest.java b/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackContextTest.java index 0afca53f3cc..8af7b0e11e5 100644 --- a/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackContextTest.java +++ b/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackContextTest.java @@ -131,6 +131,7 @@ public class HpackContextTest assertNull(ctx.get("name")); } @Test + @SuppressWarnings("ReferenceEquality") public void testGetAddStatic() { HpackContext ctx = new HpackContext(4096); diff --git a/jetty-io/src/test/java/org/eclipse/jetty/io/ArrayByteBufferPoolTest.java b/jetty-io/src/test/java/org/eclipse/jetty/io/ArrayByteBufferPoolTest.java index 7b2dd9f2cfd..fef7a562023 100644 --- a/jetty-io/src/test/java/org/eclipse/jetty/io/ArrayByteBufferPoolTest.java +++ b/jetty-io/src/test/java/org/eclipse/jetty/io/ArrayByteBufferPoolTest.java @@ -29,6 +29,7 @@ import java.util.Arrays; import org.eclipse.jetty.io.ByteBufferPool.Bucket; import org.junit.Test; +@SuppressWarnings("ReferenceEquality") public class ArrayByteBufferPoolTest { @Test @@ -113,6 +114,7 @@ public class ArrayByteBufferPoolTest } @Test + @SuppressWarnings("ReferenceEquality") public void testAcquireReleaseAcquire() throws Exception { ArrayByteBufferPool bufferPool = new ArrayByteBufferPool(10,100,1000); diff --git a/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ValidUrlRule.java b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ValidUrlRule.java index 45d6ba438ce..4cb856b9457 100644 --- a/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ValidUrlRule.java +++ b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ValidUrlRule.java @@ -115,7 +115,7 @@ public class ValidUrlRule extends Rule LOG.debug("{} {} {} {}", Character.charCount(codepoint), codepoint, block, Character.isISOControl(codepoint)); - return (!Character.isISOControl(codepoint)) && block != null && block != Character.UnicodeBlock.SPECIALS; + return (!Character.isISOControl(codepoint)) && block != null && !Character.UnicodeBlock.SPECIALS.equals(block); } public String toString() diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ResponseWriter.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ResponseWriter.java index 22a499abc4e..47103e6257c 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/ResponseWriter.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ResponseWriter.java @@ -470,11 +470,6 @@ public class ResponseWriter extends PrintWriter { _formatter = new Formatter(this, locale); } - else if(_formatter.locale()==null) - { - if(locale != null) - _formatter = new Formatter(this, locale); - } else if (!_formatter.locale().equals(locale)) { _formatter = new Formatter(this, locale); diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java index 684b9677ce5..70e2bbe1653 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java @@ -381,7 +381,7 @@ public class DoSFilter implements Filter // or if we were woken up we insist or we fail. Boolean throttled = (Boolean)request.getAttribute(__THROTTLED); long throttleMs = getThrottleMs(); - if (throttled != Boolean.TRUE && throttleMs > 0) + if (Boolean.FALSE.equals(throttled) && throttleMs > 0) { int priority = getPriority(request, tracker); request.setAttribute(__THROTTLED, Boolean.TRUE); @@ -399,7 +399,7 @@ public class DoSFilter implements Filter } Boolean resumed = (Boolean)request.getAttribute(_resumed); - if (resumed == Boolean.TRUE) + if (Boolean.TRUE.equals(resumed)) { // We were resumed, we wait for the next pass. _passes.acquire(); @@ -444,7 +444,7 @@ public class DoSFilter implements Filter { ServletRequest candidate = asyncContext.getRequest(); Boolean suspended = (Boolean)candidate.getAttribute(_suspended); - if (suspended == Boolean.TRUE) + if (Boolean.TRUE.equals(suspended)) { if (LOG.isDebugEnabled()) LOG.debug("Resuming {}", request); diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/QoSFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/QoSFilter.java index bf6a80f749c..cf46bf686ac 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/QoSFilter.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/QoSFilter.java @@ -171,7 +171,7 @@ public class QoSFilter implements Filter { request.setAttribute(_suspended, Boolean.FALSE); Boolean resumed = (Boolean)request.getAttribute(_resumed); - if (resumed == Boolean.TRUE) + if (Boolean.TRUE.equals(resumed)) { _passes.acquire(); accepted = true; @@ -222,7 +222,7 @@ public class QoSFilter implements Filter { ServletRequest candidate = asyncContext.getRequest(); Boolean suspended = (Boolean)candidate.getAttribute(_suspended); - if (suspended == Boolean.TRUE) + if (Boolean.TRUE.equals(suspended)) { candidate.setAttribute(_resumed, Boolean.TRUE); asyncContext.dispatch(); diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java index 0879311d473..69bcad311d9 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java @@ -305,7 +305,7 @@ public class Modules implements Iterable { for (Module p:providers) { - if (p!=module && p.isEnabled()) + if (!p.equals(module) && p.isEnabled()) { // If the already enabled module is transitive and this enable is not if (p.isTransitive() && !transitive) @@ -364,8 +364,8 @@ public class Modules implements Iterable } // If a provider is already enabled, then add a transitive enable - if (providers.stream().filter(Module::isEnabled).count()!=0) - providers.stream().filter(m->m.isEnabled()&&m!=module).forEach(m->enable(newlyEnabled,m,"transitive provider of "+dependsOn+" for "+module.getName(),true)); + if (providers.stream().filter(Module::isEnabled).count()>0) + providers.stream().filter(m->m.isEnabled()&&!m.equals(module)).forEach(m->enable(newlyEnabled,m,"transitive provider of "+dependsOn+" for "+module.getName(),true)); else { // Is there an obvious default? diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java b/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java index cba8dac91bc..a35cbb43881 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java @@ -238,6 +238,17 @@ public class BufferUtil } } + /** + * @param buf the buffer to check + * @return true if buf is equal to EMPTY_BUFFER + */ + public static boolean isTheEmptyBuffer(ByteBuffer buf) + { + @SuppressWarnings("ReferenceEquality") + boolean isTheEmptyBuffer_ = (buf == EMPTY_BUFFER); + return isTheEmptyBuffer_; + } + /* ------------------------------------------------------------ */ /** Check for an empty or null buffer. * @param buf the buffer to check diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/Fields.java b/jetty-util/src/main/java/org/eclipse/jetty/util/Fields.java index fd3f3212868..23b8e0713d3 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/Fields.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/Fields.java @@ -251,11 +251,10 @@ public class Fields implements Iterable this.values = Collections.unmodifiableList(list); } + @SuppressWarnings("ReferenceEquality") public boolean equals(Field that, boolean caseSensitive) { - @SuppressWarnings("ReferenceEquality") - boolean isThisInstance = (this == that); - if (isThisInstance) + if (this == that) return true; if (that == null) return false; diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/FileResource.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/FileResource.java index 296dd6a8dfe..33d73c73657 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/FileResource.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/FileResource.java @@ -407,6 +407,7 @@ public class FileResource extends Resource * @return true of the object o is a {@link FileResource} pointing to the same file as this resource. */ @Override + @SuppressWarnings("ReferenceEquality") public boolean equals( Object o) { if (this == o) @@ -416,9 +417,7 @@ public class FileResource extends Resource return false; FileResource f=(FileResource)o; - @SuppressWarnings("ReferenceEquality") - boolean sameFile = f._file==_file; - return sameFile || (null != _file && _file.equals(f._file)); + return f._file==_file || (null != _file && _file.equals(f._file)); } /* ------------------------------------------------------------ */ diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/BufferUtilTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/BufferUtilTest.java index ab3ead51d61..5d7492dff93 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/BufferUtilTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/BufferUtilTest.java @@ -297,6 +297,7 @@ public class BufferUtilTest @Test + @SuppressWarnings("ReferenceEquality") public void testEnsureCapacity() throws Exception { ByteBuffer b = BufferUtil.toBuffer("Goodbye Cruel World"); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/DateCacheTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/DateCacheTest.java index d95acb63ef3..80e06435aab 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/DateCacheTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/DateCacheTest.java @@ -40,6 +40,7 @@ public class DateCacheTest /* ------------------------------------------------------------ */ @Test @Slow + @SuppressWarnings("ReferenceEquality") public void testDateCache() throws Exception { //@WAS: Test t = new Test("org.eclipse.jetty.util.DateCache"); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/StringUtilTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/StringUtilTest.java index dfce5f4b588..273fd429aaa 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/StringUtilTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/StringUtilTest.java @@ -36,6 +36,7 @@ import static org.junit.Assert.assertTrue; public class StringUtilTest { @Test + @SuppressWarnings("ReferenceEquality") public void testAsciiToLowerCase() { String lc="\u0690bc def 1\u06903"; @@ -88,6 +89,7 @@ public class StringUtilTest } @Test + @SuppressWarnings("ReferenceEquality") public void testReplace() { String s="\u0690bc \u0690bc \u0690bc"; @@ -100,6 +102,7 @@ public class StringUtilTest } @Test + @SuppressWarnings("ReferenceEquality") public void testUnquote() { String uq =" not quoted "; @@ -112,9 +115,10 @@ public class StringUtilTest @Test + @SuppressWarnings("ReferenceEquality") public void testNonNull() { - String nn=""; + String nn="non empty string"; assertTrue(nn==StringUtil.nonNull(nn)); assertEquals("",StringUtil.nonNull(null)); } diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/TopologicalSortTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/TopologicalSortTest.java index 05eac6ef68d..3b74d30260c 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/TopologicalSortTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/TopologicalSortTest.java @@ -193,6 +193,7 @@ public class TopologicalSortTest } } + @SuppressWarnings("ReferenceEquality") private int indexOf(String[] list,String s) { for (int i=0;i