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 2017/10/13 09:11:53 UTC

svn commit: r1812088 - in /tomcat/trunk: java/org/apache/catalina/filters/RemoteIpFilter.java java/org/apache/catalina/ha/deploy/FileMessageFactory.java res/findbugs/filter-false-positives.xml

Author: markt
Date: Fri Oct 13 09:11:52 2017
New Revision: 1812088

URL: http://svn.apache.org/viewvc?rev=1812088&view=rev
Log:
Fix some FindBugs false positives
Patch provided by isapir

Modified:
    tomcat/trunk/java/org/apache/catalina/filters/RemoteIpFilter.java
    tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java
    tomcat/trunk/res/findbugs/filter-false-positives.xml

Modified: tomcat/trunk/java/org/apache/catalina/filters/RemoteIpFilter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/filters/RemoteIpFilter.java?rev=1812088&r1=1812087&r2=1812088&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/filters/RemoteIpFilter.java (original)
+++ tomcat/trunk/java/org/apache/catalina/filters/RemoteIpFilter.java Fri Oct 13 09:11:52 2017
@@ -18,6 +18,7 @@ package org.apache.catalina.filters;
 
 import java.io.IOException;
 import java.text.DateFormat;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Collections;
 import java.util.Date;
@@ -496,7 +497,7 @@ public class RemoteIpFilter extends Gene
                 DateFormat dateFormat = dateFormats[i];
                 try {
                     date = dateFormat.parse(value);
-                } catch (Exception ParseException) {
+                } catch (ParseException ex) {
                     // Ignore
                 }
             }

Modified: tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java?rev=1812088&r1=1812087&r2=1812088&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java Fri Oct 13 09:11:52 2017
@@ -310,12 +310,12 @@ public class FileMessageFactory {
         if (in != null)
             try {
                 in.close();
-            } catch (Exception ignore) {
+            } catch (IOException ignore) {
             }
         if (out != null)
             try {
                 out.close();
-            } catch (Exception ignore) {
+            } catch (IOException ignore) {
             }
         in = null;
         out = null;

Modified: tomcat/trunk/res/findbugs/filter-false-positives.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/res/findbugs/filter-false-positives.xml?rev=1812088&r1=1812087&r2=1812088&view=diff
==============================================================================
--- tomcat/trunk/res/findbugs/filter-false-positives.xml (original)
+++ tomcat/trunk/res/findbugs/filter-false-positives.xml Fri Oct 13 09:11:52 2017
@@ -28,6 +28,12 @@
     <Bug code="NP" />
   </Match>
   <Match>
+    <!-- Ignoring IOException on InputStream close -->
+    <Class name="javax.el.ExpressionFactory" />
+    <Method name="getClassNameServices" />
+    <Bug code="DE" />
+  </Match>
+  <Match>
     <!-- Only base null is handled by this resolver -->
     <Class name="javax.servlet.jsp.el.ImplicitObjectELResolver"/>
     <Or>
@@ -50,6 +56,13 @@
     <Bug code="NP" />
   </Match>
   <Match>
+    <!-- Ignore: Expected if not running on Tomcat. Not a problem since
+            this just allows a short-cut. -->
+    <Class name="javax.servlet.jsp.el.ScopedAttributeELResolver" />
+    <Method name="&lt;clinit&gt;" />
+    <Bug code="DE" />
+  </Match>
+  <Match>
     <!--  Cannot do anything about this. API is fixed by the specification. -->
     <Class name="javax.servlet.jsp.tagext.TagData"/>
     <Bug code="CN" />
@@ -188,12 +201,33 @@
     <Bug pattern="HRS_REQUEST_PARAMETER_TO_HTTP_HEADER" />
   </Match>
   <Match>
+    <!-- ParseException is ignored in loop but handled afterwards if all formats failed -->
+    <Class name="org.apache.catalina.filters.RemoteIpFilter$XForwardedRequest" />
+    <Method name="getDateHeader" />
+    <Bug code="DE" />
+  </Match>
+  <Match>
     <!-- shost will not be null in normal usage -->
     <Class name="org.apache.catalina.ha.backend.CollectedInfo" />
     <Method name="init" />
     <Bug code="NP" />
   </Match>
   <Match>
+    <!-- Ignore IOException when closing input/output streams in cleanup -->
+    <Class name="org.apache.catalina.ha.deploy.FileMessageFactory" />
+    <Method name="cleanup" />
+    <Bug code="DE" />
+  </Match>
+  <Match>
+    <!-- Ignore exceptions from Thread.sleep() -->
+    <Class name="org.apache.catalina.ha.session.DeltaManager" />
+    <Or>
+      <Method name="handleGET_ALL_SESSIONS" />
+      <Method name="waitForSendAllSessions" />
+    </Or>
+    <Bug code="DE" />
+  </Match>
+  <Match>
     <!-- Field is only modified during Servlet load -->
     <Class name="org.apache.catalina.manager.host.HostManagerServlet" />
     <Bug code="MSF" />
@@ -506,19 +540,19 @@
   <Match>
     <!-- Notify is correct. Condition changed outside of this method. -->
     <Class name="org.apache.coyote.http2.Http2UpgradeHandler" />
-    <Mehtod name="releaseBackLog" />
+    <Method name="releaseBackLog" />
     <Bug pattern="NN_NAKED_NOTIFY" />
   </Match>
   <Match>
     <!-- Return value is intentionally ignored. -->
     <Class name="org.apache.coyote.http2.Http2UpgradeHandler$PingManager" />
-    <Mehtod name="receivePing" />
+    <Method name="receivePing" />
     <Bug pattern="RV_RETURN_VALUE_IGNORED" />
   </Match>
   <Match>
     <!-- Notify is correct. Condition changed outside of this method. -->
     <Class name="org.apache.coyote.http2.Stream" />
-    <Mehtod name="incrementWindowSize" />
+    <Method name="incrementWindowSize" />
     <Bug pattern="NN_NAKED_NOTIFY" />
   </Match>
   <Match>



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