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

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


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 18832a8485 Remove unnecessary code. ctx can't be null if session is 
not null
18832a8485 is described below

commit 18832a84850a54a8ee2891af082b4bd734492aba
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 34d285c25c..4e12058d9d 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