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 f3b2da6c2e Fix failing test on platforms that don't default to UTF-8
f3b2da6c2e is described below
commit f3b2da6c2e08cc16754ce99011869a6b13fca784
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 dc95199cc4..03be82c1cb 100644
--- a/test/org/apache/jasper/servlet/TestJspCServletContext.java
+++ b/test/org/apache/jasper/servlet/TestJspCServletContext.java
@@ -20,6 +20,7 @@ import java.io.File;
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;
@@ -33,6 +34,7 @@ import jakarta.servlet.descriptor.JspConfigDescriptor;
import jakarta.servlet.descriptor.JspPropertyGroupDescriptor;
import org.junit.Assert;
+import org.junit.Assume;
import org.junit.Test;
public class TestJspCServletContext {
@@ -183,6 +185,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]