You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2011/10/10 21:00:05 UTC

svn commit: r1181139 - /tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticInternalUtils.java

Author: hlship
Date: Mon Oct 10 19:00:04 2011
New Revision: 1181139

URL: http://svn.apache.org/viewvc?rev=1181139&view=rev
Log:
TAP5-1686: Exceptions at application startup when the current directory includes spaces in the path name

Modified:
    tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticInternalUtils.java

Modified: tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticInternalUtils.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticInternalUtils.java?rev=1181139&r1=1181138&r2=1181139&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticInternalUtils.java (original)
+++ tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticInternalUtils.java Mon Oct 10 19:00:04 2011
@@ -24,8 +24,7 @@ import org.apache.tapestry5.plastic.Meth
 
 import java.io.*;
 import java.lang.reflect.Array;
-import java.net.URISyntaxException;
-import java.net.URL;
+import java.net.*;
 import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -402,18 +401,11 @@ public class PlasticInternalUtils
         // This *should* handle Tomcat better, where the Tomcat class loader appears to be caching
         // the contents of files; this bypasses Tomcat to re-read the files from the disk directly.
 
-        if (url.toString().startsWith("file:"))
+        if (url.getProtocol().equals("file"))
         {
-            try
-            {
-                return new FileInputStream(new File(url.toURI()));
-            } catch (URISyntaxException ex)
-            {
-                // Note: the simple constructor IOException(Throwable) is only since 1.6
-                IOException wrapped = new IOException(ex.getMessage());
-                wrapped.initCause(ex);
-                throw wrapped;
-            }
+	    String urlPath = url.getPath();
+	    String decoded = URLDecoder.decode(urlPath);
+            return new FileInputStream(new File(decoded));
         }
 
         return url.openStream();