You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2023/09/15 14:27:35 UTC

[tomcat] branch main updated: Remove useless null checks

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

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new ed6fcee5a3 Remove useless null checks
ed6fcee5a3 is described below

commit ed6fcee5a34fefe2d6f37f9a5b9b22e2ceb36178
Author: remm <re...@apache.org>
AuthorDate: Fri Sep 15 16:27:11 2023 +0200

    Remove useless null checks
    
    Found by coverity.
---
 java/org/apache/tomcat/util/digester/CallMethodRule.java    |  2 +-
 java/org/apache/tomcat/util/digester/SetPropertiesRule.java | 11 +++--------
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/tomcat/util/digester/CallMethodRule.java b/java/org/apache/tomcat/util/digester/CallMethodRule.java
index 91b7e56ed2..3eae7a53db 100644
--- a/java/org/apache/tomcat/util/digester/CallMethodRule.java
+++ b/java/org/apache/tomcat/util/digester/CallMethodRule.java
@@ -291,7 +291,7 @@ public class CallMethodRule extends Rule {
                 return;
             }
 
-        } else if (paramTypes != null && paramTypes.length != 0) {
+        } else if (paramTypes.length != 0) {
 
             // In the case where the parameter for the method
             // is taken from the body text, but there is no
diff --git a/java/org/apache/tomcat/util/digester/SetPropertiesRule.java b/java/org/apache/tomcat/util/digester/SetPropertiesRule.java
index 323c3f8362..64a7ff282a 100644
--- a/java/org/apache/tomcat/util/digester/SetPropertiesRule.java
+++ b/java/org/apache/tomcat/util/digester/SetPropertiesRule.java
@@ -66,14 +66,9 @@ public class SetPropertiesRule extends Rule {
         // Populate the corresponding properties of the top object
         Object top = digester.peek();
         if (digester.log.isDebugEnabled()) {
-            if (top != null) {
-                digester.log.debug("[SetPropertiesRule]{" + digester.match +
-                                   "} Set " + top.getClass().getName() +
-                                   " properties");
-            } else {
-                digester.log.debug("[SetPropertiesRule]{" + digester.match +
-                                   "} Set NULL properties");
-            }
+            digester.log.debug("[SetPropertiesRule]{" + digester.match +
+                    "} Set " + top.getClass().getName() +
+                    " properties");
         }
         StringBuilder code = digester.getGeneratedCode();
         String variableName = null;


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