You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by li...@apache.org on 2022/12/20 10:22:25 UTC
[tomcat] branch 10.1.x updated: Fix BZ 66393 - Align ExtendedAccessLogValve's x-P(XXX) with the documentation.
This is an automated email from the ASF dual-hosted git repository.
lihan pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new f065cf0118 Fix BZ 66393 - Align ExtendedAccessLogValve's x-P(XXX) with the documentation.
f065cf0118 is described below
commit f065cf0118ba4d88d493143a646c81d2991ee7a3
Author: lihan <li...@apache.org>
AuthorDate: Tue Dec 20 18:21:56 2022 +0800
Fix BZ 66393 - Align ExtendedAccessLogValve's x-P(XXX) with the documentation.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66393
---
java/org/apache/catalina/valves/ExtendedAccessLogValve.java | 11 +++--------
webapps/docs/changelog.xml | 4 ++++
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
index 852a473c43..f9e97dda18 100644
--- a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
+++ b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
@@ -19,9 +19,8 @@ package org.apache.catalina.valves;
import java.io.CharArrayWriter;
import java.io.IOException;
import java.io.StringReader;
-import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
-import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@@ -36,6 +35,7 @@ import jakarta.servlet.http.HttpSession;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.util.ServerInfo;
+import org.apache.catalina.util.URLEncoder;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.ExceptionUtils;
@@ -399,12 +399,7 @@ public class ExtendedAccessLogValve extends AccessLogValve {
if (null==value || value.length()==0) {
return null;
}
- try {
- return URLEncoder.encode(value, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- // Should never happen - all JVMs are required to support UTF-8
- return null;
- }
+ return URLEncoder.QUERY.encode(value, StandardCharsets.UTF_8);
}
@Override
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index c5b55fc943..3cb080349f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -117,6 +117,10 @@
<bug>66392</bug>: Change the default value of <code>AccessLogValue</code>'s
file encoding to UTF-8 and update documentation. (lihan)
</fix>
+ <fix>
+ <bug>66393</bug>: Align <code>ExtendedAccessLogValve</code>'s x-P(XXX) with the
+ documentation. (lihan)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org