You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2007/04/24 15:42:08 UTC

svn commit: r531938 - /tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/TldConfig.java

Author: remm
Date: Tue Apr 24 06:42:07 2007
New Revision: 531938

URL: http://svn.apache.org/viewvc?view=rev&rev=531938
Log:
- 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).

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/TldConfig.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/TldConfig.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/TldConfig.java?view=diff&rev=531938&r1=531937&r2=531938
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/TldConfig.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/TldConfig.java Tue Apr 24 06:42:07 2007
@@ -26,6 +26,7 @@
 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 @@
                                               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 @@
             if (loader instanceof URLClassLoader) {
                 URL[] urls = ((URLClassLoader) loader).getURLs();
                 for (int i=0; i<urls.length; i++) {
-                    // Expect file URLs
+                    // Expect file URLs, these are %xx encoded or not depending on
+                    // the class loader
                     // This is definitely not as clean as using JAR URLs either
                     // over file or the custom jndi handler, but a lot less
                     // buggy overall
-                    File file = new File(urls[i].getFile());
+                    File file = null;
+                    try {
+                        file = new File(urls[i].toURI());
+                    } catch (URISyntaxException e) {
+                        // Ignore, probably an unencoded char
+                        file = new File(urls[i].getFile());
+                    }
                     try {
                         file = file.getCanonicalFile();
                     } catch (IOException e) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org