[jboss-cvs] JBossAS SVN: r68801 - projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/file.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 10 03:50:48 EST 2008


Author: scott.stark at jboss.org
Date: 2008-01-10 03:50:48 -0500 (Thu, 10 Jan 2008)
New Revision: 68801

Modified:
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/file/FileSystemContext.java
Log:
Strip any query, fragment, authorization from the file URI since the File(URI) ctor does not support these

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/file/FileSystemContext.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/file/FileSystemContext.java	2008-01-10 08:12:42 UTC (rev 68800)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/file/FileSystemContext.java	2008-01-10 08:50:48 UTC (rev 68801)
@@ -59,16 +59,19 @@
     * @param uri the url
     * @return the file
     * @throws IOException for any error accessing the file system
+    * @throws URISyntaxException 
     * @throws IllegalArgumentException for a null url
     */
-   private static File getFile(URI uri) throws IOException
+   private static File getFile(URI uri) throws IOException, URISyntaxException
    {
       if (uri == null)
          throw new IllegalArgumentException("Null uri");
-      
+      // This ctor will not accept uris with authority, fragment or query
+      if(uri.getAuthority() != null || uri.getFragment() != null || uri.getQuery() != null)
+         uri = new URI("file", null, uri.getPath(), null);
       return new File(uri);
    }
-   
+
    /**
     * Get the url for a file
     * 
@@ -122,7 +125,7 @@
     * @param rootURI the root uri
     * @throws IOException for an error accessing the file system
     */
-   public FileSystemContext(URI rootURI) throws IOException
+   public FileSystemContext(URI rootURI) throws IOException, URISyntaxException
    {
       this(rootURI, getFile(rootURI));
    }




More information about the jboss-cvs-commits mailing list