You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/03/06 12:34:07 UTC
[tomcat] 03/03: Fix SpotBugs issues in unit tests
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit c8892a12398acd43b5ec21cdfd03b67e411afb2a
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Mar 6 12:33:29 2020 +0000
Fix SpotBugs issues in unit tests
---
res/findbugs/filter-false-positives.xml | 13 +++++++++++++
.../coyote/http11/upgrade/TestUpgradeInternalHandler.java | 2 +-
test/org/apache/coyote/http2/TestAsyncTimeout.java | 6 +++---
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/res/findbugs/filter-false-positives.xml b/res/findbugs/filter-false-positives.xml
index 93b4473..6d25bbd 100644
--- a/res/findbugs/filter-false-positives.xml
+++ b/res/findbugs/filter-false-positives.xml
@@ -1608,6 +1608,7 @@
<Or>
<Method name="testAuthMethodBadMethod"/>
<Method name="testBadBase64Char"/>
+ <Method name="testBadBase64InlineEquals"/>
</Or>
<Bug pattern="DLS_DEAD_LOCAL_STORE"/>
</Match>
@@ -1618,6 +1619,12 @@
<Bug pattern="MSF_MUTABLE_SERVLET_FIELD"/>
</Match>
<Match>
+ <!-- Container handles close -->
+ <Class name="org.apache.catalina.connector.TestOutputBuffer$WritingServlet"/>
+ <Method name="doGet"/>
+ <Bug pattern="OS_OPEN_STREAM"/>
+ </Match>
+ <Match>
<!-- ByteChunk.toString() can return null -->
<Class name="org.apache.catalina.connector.TestRequest"/>
<Method name="doBug56501"/>
@@ -1905,6 +1912,12 @@
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/>
</Match>
<Match>
+ <!-- Latch isn't essential so no need to check return -->
+ <Class name="org.apache.coyote.http2.TestAsyncTimeout"/>
+ <Method name="testTimeout"/>
+ <Bug pattern="RV_RETURN_VALUE_IGNORED"/>
+ </Match>
+ <Match>
<!-- Result is negated to compare result when order is reversed -->
<Class name="org.apache.el.TestELEvaluation" />
<Method name="compareBoth" />
diff --git a/test/org/apache/coyote/http11/upgrade/TestUpgradeInternalHandler.java b/test/org/apache/coyote/http11/upgrade/TestUpgradeInternalHandler.java
index eb826f8..a2c3a94 100644
--- a/test/org/apache/coyote/http11/upgrade/TestUpgradeInternalHandler.java
+++ b/test/org/apache/coyote/http11/upgrade/TestUpgradeInternalHandler.java
@@ -224,7 +224,7 @@ public class TestUpgradeInternalHandler extends TomcatBaseTest {
}, buffer);
System.out.println("CompletionState: " + state);
// Test zero length write used by websockets
- state = wrapper.write(BlockingMode.BLOCK, 10, TimeUnit.SECONDS, null, SocketWrapperBase.COMPLETE_WRITE_WITH_COMPLETION, new CompletionHandler<Long, Void>() {
+ wrapper.write(BlockingMode.BLOCK, 10, TimeUnit.SECONDS, null, SocketWrapperBase.COMPLETE_WRITE_WITH_COMPLETION, new CompletionHandler<Long, Void>() {
@Override
public void completed(Long result, Void attachment) {
System.out.println("Write: " + result.longValue());
diff --git a/test/org/apache/coyote/http2/TestAsyncTimeout.java b/test/org/apache/coyote/http2/TestAsyncTimeout.java
index b579aba..f214e0a 100644
--- a/test/org/apache/coyote/http2/TestAsyncTimeout.java
+++ b/test/org/apache/coyote/http2/TestAsyncTimeout.java
@@ -52,8 +52,8 @@ public class TestAsyncTimeout extends Http2TestBase {
// This is the servlet that does that actual test
// This latch is used to signal that that async thread used by the test
- // has ended. It isn;t essential to the test but it allows the test to
- // complete without Tmcat logging an error about a still running thread.
+ // has ended. It isn't essential to the test but it allows the test to
+ // complete without Tomcat logging an error about a still running thread.
CountDownLatch latch = new CountDownLatch(1);
Wrapper w = Tomcat.addServlet(ctxt, "async", new AsyncTimeoutServlet(latch));
w.setAsyncSupported(true);
@@ -95,7 +95,7 @@ public class TestAsyncTimeout extends Http2TestBase {
private static final long serialVersionUID = 1L;
- private final CountDownLatch latch;
+ private final transient CountDownLatch latch;
public AsyncTimeoutServlet(CountDownLatch latch) {
this.latch = latch;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org