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 32a8539e04 Fix possible NPEs
32a8539e04 is described below

commit 32a8539e040a061d15c29af13a6bfd53023e3401
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Jun 24 18:37:35 2026 +0100

    Fix possible NPEs
---
 .../apache/catalina/ha/tcp/ReplicationValve.java    | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/catalina/ha/tcp/ReplicationValve.java 
b/java/org/apache/catalina/ha/tcp/ReplicationValve.java
index 09273ff48c..0aaba38e05 100644
--- a/java/org/apache/catalina/ha/tcp/ReplicationValve.java
+++ b/java/org/apache/catalina/ha/tcp/ReplicationValve.java
@@ -298,8 +298,8 @@ public class ReplicationValve extends ValveBase implements 
ClusterValve {
     // --------------------------------------------------------- Public Methods
 
     /**
-     * Register a cross-context session for replication. The session is added 
to
-     * the current thread's cross-context session list if it is not already 
present.
+     * Register a cross-context session for replication. The session is added 
to the current thread's cross-context
+     * session list if it is not already present.
      *
      * @param session the cross-context session to register
      */
@@ -399,10 +399,10 @@ public class ReplicationValve extends ValveBase 
implements ClusterValve {
     /**
      * Send a replication message for the given request.
      *
-     * @param request the request
-     * @param totalstart the start time
+     * @param request        the request
+     * @param totalstart     the start time
      * @param isCrossContext {@code true} if cross-context
-     * @param isAsync {@code true} if async
+     * @param isAsync        {@code true} if async
      * @param clusterManager the cluster manager
      */
     protected void sendReplicationMessage(Request request, long totalstart, 
boolean isCrossContext, boolean isAsync,
@@ -620,16 +620,19 @@ 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", 
request.getContext().getName(), id,
-                            primaryIndicatorName, 
Boolean.valueOf(cses.isPrimarySession())));
+                    
log.debug(sm.getString("ReplicationValve.session.indicator",
+                            ctx == null ? "null Context" : 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", 
request.getContext().getName(), id));
+                        
log.debug(sm.getString("ReplicationValve.session.found",
+                                ctx == null ? "null Context" : ctx.getPath(), 
id));
                     } else {
-                        
log.debug(sm.getString("ReplicationValve.session.invalid", 
request.getContext().getName(), id));
+                        
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