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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jxpath.git

commit d4d218b6d068343a67c5ad0af28aa24b4d9aebe2
Author: Gary D. Gregory <[email protected]>
AuthorDate: Sun Mar 16 13:26:37 2025 -0400

    No need to nest else
---
 .../java/org/apache/commons/jxpath/servlet/HttpSessionHandler.java  | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/jxpath/servlet/HttpSessionHandler.java 
b/src/main/java/org/apache/commons/jxpath/servlet/HttpSessionHandler.java
index 2104d75..5a55a13 100644
--- a/src/main/java/org/apache/commons/jxpath/servlet/HttpSessionHandler.java
+++ b/src/main/java/org/apache/commons/jxpath/servlet/HttpSessionHandler.java
@@ -62,12 +62,10 @@ public class HttpSessionHandler extends 
ServletContextHandler {
         final HttpSessionAndServletContext handle =
             (HttpSessionAndServletContext) bean;
         final HttpSession session = handle.getSession();
-        if (session != null) {
-            session.setAttribute(property, value);
-        }
-        else {
+        if (session == null) {
             throw new JXPathException("Cannot set session attribute: "
                     + "there is no session");
         }
+        session.setAttribute(property, value);
     }
 }

Reply via email to