You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2026/06/24 17:37:43 UTC
(tomcat) branch main updated: Fix possible NPEs
This is an automated email from the ASF dual-hosted git repository.
markt-asf 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 a848628ffb Fix possible NPEs
a848628ffb is described below
commit a848628ffb84f5e49b904c5258f4aea770540c60
Author: Mark Thomas <ma...@apache.org>
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 997e6adab9..a535313d48 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
*/
@@ -398,10 +398,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,
@@ -618,16 +618,19 @@ public class ReplicationValve extends ValveBase implements ClusterValve {
}
if (session instanceof ClusterSession cses) {
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org