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

markt-asf 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 2f443c50ac Remove unnecessary code. ctx can't be null if session is 
not null
2f443c50ac is described below

commit 2f443c50ac2cac9c692d5b9a00af6097d832c0b4
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Jun 30 15:59:32 2026 +0100

    Remove unnecessary code. ctx can't be null if session is not null
---
 java/org/apache/catalina/ha/tcp/ReplicationValve.java | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/catalina/ha/tcp/ReplicationValve.java 
b/java/org/apache/catalina/ha/tcp/ReplicationValve.java
index 0aaba38e05..059c838a26 100644
--- a/java/org/apache/catalina/ha/tcp/ReplicationValve.java
+++ b/java/org/apache/catalina/ha/tcp/ReplicationValve.java
@@ -606,6 +606,7 @@ public class ReplicationValve extends ValveBase implements 
ClusterValve {
      *
      * @throws IOException IO error finding session
      */
+    @SuppressWarnings("null") // ctx can't be null
     protected void createPrimaryIndicator(Request request) throws IOException {
         String id = request.getRequestedSessionId();
         if ((id != null) && (!id.isEmpty())) {
@@ -620,16 +621,14 @@ public class ReplicationValve extends ValveBase 
implements ClusterValve {
             if (session instanceof ClusterSession) {
                 ClusterSession cses = (ClusterSession) session;
                 if (log.isDebugEnabled()) {
-                    
log.debug(sm.getString("ReplicationValve.session.indicator",
-                            ctx == null ? "null Context" : ctx.getPath(), id, 
primaryIndicatorName,
+                    
log.debug(sm.getString("ReplicationValve.session.indicator", ctx.getPath(), id, 
primaryIndicatorName,
                             Boolean.valueOf(cses.isPrimarySession())));
                 }
                 request.setAttribute(primaryIndicatorName, 
cses.isPrimarySession() ? Boolean.TRUE : Boolean.FALSE);
             } else {
                 if (log.isDebugEnabled()) {
                     if (session != null) {
-                        
log.debug(sm.getString("ReplicationValve.session.found",
-                                ctx == null ? "null Context" : ctx.getPath(), 
id));
+                        
log.debug(sm.getString("ReplicationValve.session.found", ctx.getPath(), id));
                     } else {
                         
log.debug(sm.getString("ReplicationValve.session.invalid",
                                 ctx == null ? "null Context" : ctx.getPath(), 
id));


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to