This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 0c2bd665850ae54532584b2ad0ad46f33fbcdd02 Author: Mark Thomas <ma...@apache.org> AuthorDate: Mon Mar 16 15:57:13 2020 +0000 Make all calls to URLDecode use an explicit character set --- java/org/apache/catalina/loader/WebappLoader.java | 5 +++-- test/org/apache/tomcat/util/buf/TestUDecoder.java | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/java/org/apache/catalina/loader/WebappLoader.java b/java/org/apache/catalina/loader/WebappLoader.java index 75bb589..604d133 100644 --- a/java/org/apache/catalina/loader/WebappLoader.java +++ b/java/org/apache/catalina/loader/WebappLoader.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.lang.reflect.Constructor; import java.net.URL; import java.net.URLClassLoader; +import java.nio.charset.StandardCharsets; import javax.management.ObjectName; @@ -573,9 +574,9 @@ public class WebappLoader extends LifecycleMBeanBase for (int i = 0; i < repositories.length; i++) { String repository = repositories[i].toString(); if (repository.startsWith("file://")) - repository = UDecoder.URLDecode(repository.substring(7)); + repository = UDecoder.URLDecode(repository.substring(7), StandardCharsets.UTF_8); else if (repository.startsWith("file:")) - repository = UDecoder.URLDecode(repository.substring(5)); + repository = UDecoder.URLDecode(repository.substring(5), StandardCharsets.UTF_8); else continue; if (repository == null) diff --git a/test/org/apache/tomcat/util/buf/TestUDecoder.java b/test/org/apache/tomcat/util/buf/TestUDecoder.java index d3264c2..ca7dd23 100644 --- a/test/org/apache/tomcat/util/buf/TestUDecoder.java +++ b/test/org/apache/tomcat/util/buf/TestUDecoder.java @@ -28,7 +28,7 @@ public class TestUDecoder { // %n rather than %nn should throw an IAE according to the Javadoc Exception exception = null; try { - UDecoder.URLDecode("%5xxxxx"); + UDecoder.URLDecode("%5xxxxx", StandardCharsets.UTF_8); } catch (Exception e) { exception = e; } @@ -37,7 +37,7 @@ public class TestUDecoder { // Edge case trying to trigger ArrayIndexOutOfBoundsException exception = null; try { - UDecoder.URLDecode("%5"); + UDecoder.URLDecode("%5", StandardCharsets.UTF_8); } catch (Exception e) { exception = e; } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org