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 f05f0d8720 Fix failing test on platforms that don't default to UTF-8
f05f0d8720 is described below
commit f05f0d87202f7d0ed26189657fac215123d6c80d
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Nov 9 14:05:30 2026 +0000
Fix failing test on platforms that don't default to UTF-8
---
test/org/apache/jasper/servlet/TestJspCServletContext.java | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/test/org/apache/jasper/servlet/TestJspCServletContext.java
b/test/org/apache/jasper/servlet/TestJspCServletContext.java
index 0e061aabf0..17e60af95e 100644
--- a/test/org/apache/jasper/servlet/TestJspCServletContext.java
+++ b/test/org/apache/jasper/servlet/TestJspCServletContext.java
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.JarURLConnection;
import java.net.URL;
+import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.Collection;
@@ -36,6 +37,7 @@ import javax.servlet.descriptor.JspConfigDescriptor;
import javax.servlet.descriptor.JspPropertyGroupDescriptor;
import org.junit.Assert;
+import org.junit.Assume;
import org.junit.Test;
public class TestJspCServletContext {
@@ -147,6 +149,14 @@ public class TestJspCServletContext {
@Test
public void testGetResourceWithUriIllegalCharacters() throws Exception {
+ // This is an undocumented property so treat with caution.
+ String fileSystemPathEncoding = System.getProperty("sun.jnu.encoding");
+ System.out.println(fileSystemPathEncoding);
+ if (fileSystemPathEncoding != null) {
+ Charset fileSystemPathCharset =
Charset.forName(fileSystemPathEncoding);
+ Assume.assumeTrue("File system path encoding can't encode \u00fc.
Consider using UTF-8.",
+ fileSystemPathCharset.newEncoder().canEncode('\u00fc'));
+ }
// A resource path is a decoded logical path. Resources whose name
// contains characters that are not permitted in a URI, for example a
// space or a non-ASCII character, resolve correctly at runtime so
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]