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 80241a24ec Remove unnecessary code. ctx can't be null if session is
not null
80241a24ec is described below
commit 80241a24ec3a20b74a3bbe03a208ce0b4212f7a9
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 a535313d48..d35955da50 100644
--- a/java/org/apache/catalina/ha/tcp/ReplicationValve.java
+++ b/java/org/apache/catalina/ha/tcp/ReplicationValve.java
@@ -605,6 +605,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())) {
@@ -618,16 +619,14 @@ public class ReplicationValve extends ValveBase
implements ClusterValve {
}
if (session instanceof ClusterSession cses) {
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]