From adc5ade51d5e349fc9f4981492615ceaacad908e Mon Sep 17 00:00:00 2001 From: remm Date: Tue, 24 Apr 2007 13:42:07 +0000 Subject: [PATCH] - 42202: Fix a problem handling %xx encoded URLs (unfortunately, some are encoded - the webapp CL and the system CL - and some are not - the URL CL). git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@531938 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/startup/TldConfig.java | 26 +++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/java/org/apache/catalina/startup/TldConfig.java b/java/org/apache/catalina/startup/TldConfig.java index 91d0d8e49..2cab5f8c0 100644 --- a/java/org/apache/catalina/startup/TldConfig.java +++ b/java/org/apache/catalina/startup/TldConfig.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import java.net.URISyntaxException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; @@ -427,8 +428,18 @@ public final class TldConfig { resourcePath)); } - File file = new File(url.getFile()); - file = file.getCanonicalFile(); + File file = null; + try { + file = new File(url.toURI()); + } catch (URISyntaxException e) { + // Ignore, probably an unencoded char + file = new File(url.getFile()); + } + try { + file = file.getCanonicalFile(); + } catch (IOException e) { + // Ignore + } tldScanJar(file); } @@ -674,11 +685,18 @@ public final class TldConfig { if (loader instanceof URLClassLoader) { URL[] urls = ((URLClassLoader) loader).getURLs(); for (int i=0; i