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/05/27 09:12:36 UTC
(tomcat) branch 10.1.x updated (f653e47f12 -> cd7bedbc2b)
This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a change to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
from f653e47f12 Account for additional user added to test user database
new 612837e3a7 Fix unused end <-> length confusion
new cd7bedbc2b Re-work null check
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
java/org/apache/catalina/valves/LocalStrings.properties | 2 ++
java/org/apache/catalina/valves/ValveBase.java | 10 +++++-----
java/org/apache/tomcat/util/json/JSONFilter.java | 8 ++++----
3 files changed, 11 insertions(+), 9 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
(tomcat) 01/02: Fix unused end <-> length confusion
Posted by ma...@apache.org.
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
commit 612837e3a788fd77c7fd6629b079a46d5837fb08
Author: remm <re...@apache.org>
AuthorDate: Wed May 27 11:02:54 2026 +0200
Fix unused end <-> length confusion
---
java/org/apache/tomcat/util/json/JSONFilter.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/java/org/apache/tomcat/util/json/JSONFilter.java b/java/org/apache/tomcat/util/json/JSONFilter.java
index 3d4aff5f11..11710f1bee 100644
--- a/java/org/apache/tomcat/util/json/JSONFilter.java
+++ b/java/org/apache/tomcat/util/json/JSONFilter.java
@@ -85,7 +85,7 @@ public class JSONFilter {
*/
StringBuilder escaped = null;
int lastUnescapedStart = off;
- for (int i = off; i < length; i++) {
+ for (int i = off; i < off + length; i++) {
char c = input.charAt(i);
if (c < 0x20 || c == 0x22 || c == 0x5c || Character.isHighSurrogate(c) || Character.isLowSurrogate(c)) {
if (escaped == null) {
@@ -108,11 +108,11 @@ public class JSONFilter {
if (off == 0 && length == input.length()) {
return input;
} else {
- return input.subSequence(off, length - off);
+ return input.subSequence(off, off + length);
}
} else {
- if (lastUnescapedStart < length) {
- escaped.append(input.subSequence(lastUnescapedStart, length));
+ if (lastUnescapedStart < off + length) {
+ escaped.append(input.subSequence(lastUnescapedStart, off + length));
}
return escaped.toString();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
(tomcat) 02/02: Re-work null check
Posted by ma...@apache.org.
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
commit cd7bedbc2bbd00651d432a8fbfac766d2f45f64d
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed May 27 09:47:04 2026 +0100
Re-work null check
The previous code would still have triggered an NPE as
super.initInternal() calls getObjectNameKeyProperties() which depends on
a non-null return from getContainer()
---
java/org/apache/catalina/valves/LocalStrings.properties | 2 ++
java/org/apache/catalina/valves/ValveBase.java | 10 +++++-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/java/org/apache/catalina/valves/LocalStrings.properties b/java/org/apache/catalina/valves/LocalStrings.properties
index 07177e298a..86b82d7449 100644
--- a/java/org/apache/catalina/valves/LocalStrings.properties
+++ b/java/org/apache/catalina/valves/LocalStrings.properties
@@ -173,3 +173,5 @@ stuckThreadDetectionValve.interrupted=Thread interrupted after the request is fi
stuckThreadDetectionValve.notifyStuckThreadCompleted=Thread [{0}] (id=[{3}]) was previously reported to be stuck but has completed. It was active for approximately [{1}] milliseconds.{2,choice,0#|0< There is/are still [{2}] thread(s) that are monitored by this Valve and may be stuck.}
stuckThreadDetectionValve.notifyStuckThreadDetected=Thread [{0}] (id=[{6}]) has been active for [{1}] milliseconds (since [{2}]) to serve the same request for [{4}] and may be stuck (configured threshold for this StuckThreadDetectionValve is [{5}] seconds). There is/are [{3}] thread(s) in total that are monitored by this Valve and may be stuck.
stuckThreadDetectionValve.notifyStuckThreadInterrupted=Thread [{0}] (id=[{5}]) has been interrupted because it was active for [{1}] milliseconds (since [{2}]) to serve the same request for [{3}] and was probably stuck (configured interruption threshold for this StuckThreadDetectionValve is [{4}] seconds).
+
+valveBase.noContainer=A Container must be configured before a Valve can be initialized
diff --git a/java/org/apache/catalina/valves/ValveBase.java b/java/org/apache/catalina/valves/ValveBase.java
index 0bbf8b81e8..b5318392f9 100644
--- a/java/org/apache/catalina/valves/ValveBase.java
+++ b/java/org/apache/catalina/valves/ValveBase.java
@@ -25,7 +25,6 @@ import org.apache.catalina.Valve;
import org.apache.catalina.util.LifecycleMBeanBase;
import org.apache.catalina.util.ToStringUtil;
import org.apache.juli.logging.Log;
-import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.res.StringManager;
/**
@@ -35,8 +34,6 @@ import org.apache.tomcat.util.res.StringManager;
*/
public abstract class ValveBase extends LifecycleMBeanBase implements Contained, Valve {
- private static final Log log = LogFactory.getLog(ValveBase.class);
-
/**
* StringManager for internationalized strings.
*/
@@ -146,9 +143,12 @@ public abstract class ValveBase extends LifecycleMBeanBase implements Contained,
@Override
protected void initInternal() throws LifecycleException {
- super.initInternal();
Container container = getContainer();
- containerLog = container != null ? container.getLogger() : log;
+ if (container == null) {
+ throw new IllegalStateException(sm.getString("valveBase.noContainer"));
+ }
+ super.initInternal();
+ containerLog = container.getLogger();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org