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 1aa82709ab Follow-up to "Ignore a null charset in the
AddDefaultCharsetFilter..."
1aa82709ab is described below
commit 1aa82709abc292c6272393db2746239a3ce8848d
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Oct 1 16:06:25 2026 +0100
Follow-up to "Ignore a null charset in the AddDefaultCharsetFilter..."
- Reset the encoding to the default if the application clears any
explicit value.
- Handle the Charset setter
---
.../apache/catalina/filters/AddDefaultCharsetFilter.java | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/catalina/filters/AddDefaultCharsetFilter.java
b/java/org/apache/catalina/filters/AddDefaultCharsetFilter.java
index 119f0fe81e..9414efaff9 100644
--- a/java/org/apache/catalina/filters/AddDefaultCharsetFilter.java
+++ b/java/org/apache/catalina/filters/AddDefaultCharsetFilter.java
@@ -152,9 +152,21 @@ public class AddDefaultCharsetFilter extends FilterBase {
@Override
public void setCharacterEncoding(String charset) {
super.setCharacterEncoding(charset);
- if (charset != null) {
+ if (charset == null) {
+ encoding = DEFAULT_ENCODING;
+ } else {
encoding = charset;
}
}
+
+ @Override
+ public void setCharacterEncoding(Charset encoding) {
+ super.setCharacterEncoding(encoding);
+ if (encoding == null) {
+ this.encoding = DEFAULT_ENCODING;
+ } else {
+ this.encoding = encoding.name();
+ }
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]