You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/10/06 18:57:37 UTC

svn commit: r1707088 - /tomcat/trunk/java/org/apache/tomcat/util/file/ConfigFileLoader.java

Author: markt
Date: Tue Oct  6 16:57:37 2015
New Revision: 1707088

URL: http://svn.apache.org/viewvc?rev=1707088&view=rev
Log:
Correct an error in the fix for BZ 56777 that did not correctly handle absolute paths on Windows.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/file/ConfigFileLoader.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/file/ConfigFileLoader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/file/ConfigFileLoader.java?rev=1707088&r1=1707087&r2=1707088&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/file/ConfigFileLoader.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/file/ConfigFileLoader.java Tue Oct  6 16:57:37 2015
@@ -56,13 +56,21 @@ public class ConfigFileLoader {
      *                     provided location
      */
     public static InputStream getInputStream(String location) throws IOException {
-
-        // Absolute URIs will be left alone
+    	// Absolute URIs will be left alone
         // Relative files will be resolved relative to catalina base
         // Absolute files will be converted to URIs
-        URI uri = CATALINA_BASE_URI.resolve(location);
-        URL url = uri.toURL();
-
+    	URI uri;
+    	if (location != null &&
+    			(location.length() > 2 && ":\\".equals(location.substring(1, 3)) ||
+    				location.startsWith("\\\\"))) {
+			// This is an absolute file path in Windows or a UNC path
+			File f = new File(location);
+			uri =f.getAbsoluteFile().toURI();
+		} else {
+			// URL, relative path or an absolute path on a non-Windows platforms
+			uri = CATALINA_BASE_URI.resolve(location);
+		}
+    	URL url = uri.toURL();
         return url.openConnection().getInputStream();
     }
 }



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