This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 87daf35 Fix SpotBugs issues in unit tests
87daf35 is described below
commit 87daf35cd4617108a2d9b974367732bcb1c31bf3
Author: Mark Thomas <[email protected]>
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 cefc6fe..2042544 100644
--- a/res/findbugs/filter-false-positives.xml
+++ b/res/findbugs/filter-false-positives.xml
@@ -1602,6 +1602,7 @@
<Or>
<Method name="testAuthMethodBadMethod"/>
<Method name="testBadBase64Char"/>
+ <Method name="testBadBase64InlineEquals"/>
</Or>
<Bug pattern="DLS_DEAD_LOCAL_STORE"/>
</Match>
@@ -1612,6 +1613,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"/>
@@ -1899,6 +1906,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 41a6511..6207fa5 100644
--- a/test/org/apache/coyote/http11/upgrade/TestUpgradeInternalHandler.java
+++ b/test/org/apache/coyote/http11/upgrade/TestUpgradeInternalHandler.java
@@ -223,7 +223,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 1e97490..8560229 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: [email protected]
For additional commands, e-mail: [email protected]