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 2022/03/15 17:54:14 UTC

[tomcat] branch 8.5.x updated (0346b14 -> 8a7bbe9)

This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


    from 0346b14  Avoid possible NPE
     new fea9210  Expand spotbugs Ant task to cover test code
     new a654701  Fix sync issues identified by SpotBugs
     new 8a7bbe9  Back-port additional false positives

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 build.xml                                          |  2 +-
 res/spotbugs/filter-false-positives.xml            | 11 +++++++++-
 .../catalina/nonblocking/TestNonBlockingAPI.java   |  3 ++-
 .../tribes/test/transport/SocketNioReceive.java    | 24 ++++++++++++++--------
 webapps/docs/changelog.xml                         |  4 ++++
 5 files changed, 32 insertions(+), 12 deletions(-)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 01/03: Expand spotbugs Ant task to cover test code

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit fea92100ddaa2aa86827219fdf3fb614ce69868c
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Mar 15 17:17:55 2022 +0000

    Expand spotbugs Ant task to cover test code
---
 build.xml                  | 2 +-
 webapps/docs/changelog.xml | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/build.xml b/build.xml
index 8427711..b3cacd3 100644
--- a/build.xml
+++ b/build.xml
@@ -1625,7 +1625,7 @@
 
   <target name="spotbugs"
           if="${execute.spotbugs}"
-          depends="compile,download-spotbugs">
+          depends="test-compile,download-spotbugs">
 
     <path id="spotbugs.classpath">
       <fileset file="${spotbugs.jar}" />
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 11bc548..66a0baf 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -116,6 +116,10 @@
       <update>
         Update to SpotBugs 4.6.0. (markt)
       </update>
+      <add>
+        Expand the <code>spotbugs</code> Ant task to also cover test code.
+        (markt)
+      </add>
     </changelog>
   </subsection>
 </section>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 03/03: Back-port additional false positives

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 8a7bbe9db6f1abb1f3c10982f3a1fbf5adfdb60f
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Mar 15 17:39:59 2022 +0000

    Back-port additional false positives
---
 res/spotbugs/filter-false-positives.xml | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/res/spotbugs/filter-false-positives.xml b/res/spotbugs/filter-false-positives.xml
index 8e256b3..6aed839 100644
--- a/res/spotbugs/filter-false-positives.xml
+++ b/res/spotbugs/filter-false-positives.xml
@@ -2000,7 +2000,10 @@
   <Match>
     <!-- Return value of latch is intentionally ignored -->
     <Class name="org.apache.catalina.nonblocking.TestNonBlockingAPI"/>
-    <Method name="testDelayedNBWrite"/>
+    <Or>
+      <Method name="testDelayedNBReadWrite"/>
+      <Method name="testDelayedNBWrite"/>
+    </Or>
     <Bug pattern="RV_RETURN_VALUE_IGNORED"/>
   </Match>
   <Match>
@@ -2552,4 +2555,10 @@
     </Or>
     <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/>
   </Match>
+  <Match>
+      <!-- There is no null check - SpotBugs bug? -->
+    <Class name="org.apache.tomcat.websocket.server.TestWsServerContainer" />
+    <Method name="testBug58232" />
+    <Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE"/>
+  </Match>
 </FindBugsFilter>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 02/03: Fix sync issues identified by SpotBugs

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit a65470102b01cdc0d38c75c8eaf25af5e49fe8a6
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Mar 15 17:18:09 2022 +0000

    Fix sync issues identified by SpotBugs
---
 .../catalina/nonblocking/TestNonBlockingAPI.java   |  3 ++-
 .../tribes/test/transport/SocketNioReceive.java    | 24 ++++++++++++++--------
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java b/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java
index 8973b71..2730e44 100644
--- a/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java
+++ b/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java
@@ -1143,7 +1143,8 @@ public class TestNonBlockingAPI extends TomcatBaseTest {
                     try {
                         byte buffer[] = new byte[1 * 4];
                         while (is.isReady() && !is.isFinished()) {
-                            is.read(buffer);
+                            @SuppressWarnings("unused")
+                            int ignore = is.read(buffer);
                         }
                         String body = new String(buffer, StandardCharsets.UTF_8);
                         Assert.assertTrue(body.equals("body"));
diff --git a/test/org/apache/catalina/tribes/test/transport/SocketNioReceive.java b/test/org/apache/catalina/tribes/test/transport/SocketNioReceive.java
index 763d7b2..9936c63 100644
--- a/test/org/apache/catalina/tribes/test/transport/SocketNioReceive.java
+++ b/test/org/apache/catalina/tribes/test/transport/SocketNioReceive.java
@@ -27,13 +27,15 @@ import org.apache.catalina.tribes.membership.MemberImpl;
 import org.apache.catalina.tribes.transport.nio.NioReceiver;
 
 public class SocketNioReceive {
-    static int count = 0;
-    static int accept = 0;
-    static long start = 0;
-    static double mb = 0;
-    static int len = 0;
-    static DecimalFormat df = new DecimalFormat("##.00");
-    static double seconds = 0;
+    private static int count = 0;
+    private static final Object countLock = new Object();
+    private static int accept = 0;
+    private static final Object acceptLock = new Object();
+    private static long start = 0;
+    private static double mb = 0;
+    private static int len = 0;
+    private static DecimalFormat df = new DecimalFormat("##.00");
+    private static double seconds = 0;
 
     protected static final Object mutex = new Object();
     public static void main(String[] args) throws Exception {
@@ -74,7 +76,9 @@ public class SocketNioReceive {
                 start = System.currentTimeMillis();
             }
             mb += ( (double) len) / 1024 / 1024;
-            synchronized (this) {count++;}
+            synchronized (countLock) {
+                count++;
+            }
             if ( ( (count) % 10000) == 0) {
                 long time = System.currentTimeMillis();
                 seconds = ( (double) (time - start)) / 1000;
@@ -84,7 +88,9 @@ public class SocketNioReceive {
 
         @Override
         public boolean accept(ChannelMessage msg) {
-            synchronized (this) {accept++;}
+            synchronized (acceptLock) {
+                accept++;
+            }
             return true;
         }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org