Use proper method to construct an URL string.
authorkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 2 Oct 2009 10:39:21 +0000 (10:39 +0000)
committerkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 2 Oct 2009 10:39:21 +0000 (10:39 +0000)
File.toURI() takes care of absolute paths, trailing slashes in the names of directories, encoding of special characters such as '%'.
Based on a suggestion by Rainer Jung.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@820954 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/loader/VirtualWebappLoader.java

index d77a590..49ba01f 100644 (file)
@@ -91,11 +91,7 @@ public class VirtualWebappLoader extends WebappLoader {
             if (!file.exists()) {
                 continue;
             }
-            if (file.isDirectory()) {
-                addRepository("file:/" + file.getAbsolutePath() + "/");
-            } else {
-                addRepository("file:/" + file.getAbsolutePath());
-            }
+            addRepository(file.toURI().toString());
         }
 
         super.start();