You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@apache.org on 2005/08/24 00:38:47 UTC

svn commit: r239472 - /struts/sandbox/trunk/tiles/src/test/org/apache/tiles/TestReloadableDefinitionsFactory.java

Author: craigmcc
Date: Tue Aug 23 15:38:45 2005
New Revision: 239472

URL: http://svn.apache.org/viewcvs?rev=239472&view=rev
Log:
Refine URL generation to deal with idiosyncracies on URL.toExternalForm()
on Windows.

Modified:
    struts/sandbox/trunk/tiles/src/test/org/apache/tiles/TestReloadableDefinitionsFactory.java

Modified: struts/sandbox/trunk/tiles/src/test/org/apache/tiles/TestReloadableDefinitionsFactory.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/tiles/src/test/org/apache/tiles/TestReloadableDefinitionsFactory.java?rev=239472&r1=239471&r2=239472&view=diff
==============================================================================
--- struts/sandbox/trunk/tiles/src/test/org/apache/tiles/TestReloadableDefinitionsFactory.java (original)
+++ struts/sandbox/trunk/tiles/src/test/org/apache/tiles/TestReloadableDefinitionsFactory.java Tue Aug 23 15:38:45 2005
@@ -69,8 +69,21 @@
             // Set up multiple data sources.
             URL url = this.getClass().getClassLoader().getResource(
                     "org/apache/tiles/config/temp-defs.xml");
-	    URI uri = new URI(url.toExternalForm());
             
+            URI uri = null;
+            String urlPath = null;
+
+            // The following madness is necessary b/c of the way Windows hanndles URLs.
+            // We must add a slash to the protocol if Windows does not.  But we cannot
+            // add a slash to Unix paths b/c they already have one.
+            if (url.getPath().startsWith("/")) {
+                urlPath = "file:" + url.getPath();
+	        uri = new URI(urlPath);
+            } else {
+                urlPath = "file:/" + url.getPath();
+	        uri = new URI(urlPath);
+            }
+
             String xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" +
              "<!DOCTYPE tiles-definitions PUBLIC " +
                    "\"-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN\" " +



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