[jboss-cvs] JBossAS SVN: r66633 - in projects/vfs/trunk/src: main/java/org/jboss/virtual/plugins/vfs and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Oct 31 17:09:11 EDT 2007


Author: alesj
Date: 2007-10-31 17:09:11 -0400 (Wed, 31 Oct 2007)
New Revision: 66633

Modified:
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledUrlStreamHandler.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/vfs/VirtualFileUrlStreamHandler.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfs/Handler.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsfile/Handler.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsjar/Handler.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsmemory/Handler.java
   projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/URLConnectionUnitTestCase.java
Log:
Clean up.

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledUrlStreamHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledUrlStreamHandler.java	2007-10-31 20:55:55 UTC (rev 66632)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledUrlStreamHandler.java	2007-10-31 21:09:11 UTC (rev 66633)
@@ -21,14 +21,14 @@
 */
 package org.jboss.virtual.plugins.context.vfs;
 
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+
+import org.jboss.virtual.plugins.vfs.VirtualFileURLConnection;
 import org.jboss.virtual.spi.VirtualFileHandler;
-import org.jboss.virtual.plugins.vfs.VirtualFileURLConnection;
 
-import java.net.URLStreamHandler;
-import java.net.URLConnection;
-import java.net.URL;
-import java.io.IOException;
-
 /**
  * Used when creating VFS urls so we don't have to go through the handlers all the time
  *
@@ -39,17 +39,18 @@
 {
    private final AssembledContext context;
 
-
    public AssembledUrlStreamHandler(AssembledContext context)
    {
       this.context = context;
    }
 
-   protected URLConnection openConnection(URL u) throws IOException
+   protected URLConnection openConnection(URL url) throws IOException
    {
-      String path = u.getPath();
+      String path = url.getPath();
       VirtualFileHandler vf = context.getRoot().findChild(path);
-      if (vf == null) throw new IOException(path + " was not found in Assembled VFS context " + context.getName());
-      return new VirtualFileURLConnection(u, vf.getVirtualFile());
+      if (vf == null)
+         throw new IOException(path + " was not found in Assembled VFS context " + context.getName());
+
+      return new VirtualFileURLConnection(url, vf.getVirtualFile());
    }
 }

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/vfs/VirtualFileUrlStreamHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/vfs/VirtualFileUrlStreamHandler.java	2007-10-31 20:55:55 UTC (rev 66632)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/vfs/VirtualFileUrlStreamHandler.java	2007-10-31 21:09:11 UTC (rev 66633)
@@ -21,16 +21,15 @@
 */
 package org.jboss.virtual.plugins.vfs;
 
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+
+import org.jboss.virtual.spi.VFSContext;
 import org.jboss.virtual.spi.VirtualFileHandler;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.VirtualFile;
 
-import java.net.URLStreamHandler;
-import java.net.URLConnection;
-import java.net.URL;
-import java.net.URISyntaxException;
-import java.io.IOException;
-
 /**
  * Used when creating VFS urls so we don't have to go through the handlers all the time
  *
@@ -41,7 +40,6 @@
 {
    private final VFSContext context;
 
-
    public VirtualFileUrlStreamHandler(VirtualFileHandler handler)
    {
       this.context = handler.getVFSContext();
@@ -49,7 +47,7 @@
 
    protected URLConnection openConnection(URL u) throws IOException
    {
-      String baseRootUrl = null;
+      String baseRootUrl;
       try
       {
          baseRootUrl = context.getRoot().toVfsUrl().toString();
@@ -64,10 +62,14 @@
       }
       String urlString = u.toString();
       int idx = urlString.indexOf(baseRootUrl);
-      if (idx == -1) throw new IOException(u.toString() + " does not belong to the same VFS context as " + baseRootUrl);
+      if (idx == -1)
+         throw new IOException(u.toString() + " does not belong to the same VFS context as " + baseRootUrl);
+
       String path = urlString.substring(baseRootUrl.length());
       VirtualFileHandler vf = context.getRoot().findChild(path);
-      if (vf == null) throw new IOException(path + " was not found in VFS context " + baseRootUrl);
+      if (vf == null)
+         throw new IOException(path + " was not found in VFS context " + baseRootUrl);
+
       return new VirtualFileURLConnection(u, vf.getVirtualFile());
    }
 }

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfs/Handler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfs/Handler.java	2007-10-31 20:55:55 UTC (rev 66632)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfs/Handler.java	2007-10-31 21:09:11 UTC (rev 66633)
@@ -21,16 +21,16 @@
 */
 package org.jboss.virtual.protocol.vfs;
 
-import org.jboss.virtual.plugins.vfs.VirtualFileURLConnection;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+
+import org.jboss.virtual.VirtualFile;
 import org.jboss.virtual.plugins.context.vfs.AssembledContextFactory;
 import org.jboss.virtual.plugins.context.vfs.AssembledDirectory;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.vfs.VirtualFileURLConnection;
 
-import java.net.URLStreamHandler;
-import java.net.URLConnection;
-import java.net.URL;
-import java.io.IOException;
-
 /**
  * URLStreamHandler for VFS
  *
@@ -43,9 +43,13 @@
    {
       String host = u.getHost();
       AssembledDirectory directory = AssembledContextFactory.getInstance().find(host);
-      if (directory == null) throw new IOException("vfs does not exist: " + u.toString());
+      if (directory == null)
+         throw new IOException("vfs does not exist: " + u.toString());
+
       VirtualFile vf = directory.findChild(u.getPath());
-      if (vf == null) throw new IOException("vfs does not exist: " + u.toString());
+      if (vf == null)
+         throw new IOException("vfs does not exist: " + u.toString());
+
       return new VirtualFileURLConnection(u, vf);
    }
 

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsfile/Handler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsfile/Handler.java	2007-10-31 20:55:55 UTC (rev 66632)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsfile/Handler.java	2007-10-31 21:09:11 UTC (rev 66633)
@@ -21,14 +21,14 @@
 */
 package org.jboss.virtual.protocol.vfsfile;
 
-import org.jboss.virtual.plugins.vfs.VirtualFileURLConnection;
-
 import java.io.File;
 import java.io.IOException;
 import java.net.URL;
 import java.net.URLConnection;
 import java.net.URLStreamHandler;
 
+import org.jboss.virtual.plugins.vfs.VirtualFileURLConnection;
+
 /**
  * URLStreamHandler for VFS
  *
@@ -68,7 +68,7 @@
 
       if (vfsurl == null)
          throw new IOException("vfsfile does not exist: " + u.toString());
+
       return new VirtualFileURLConnection(u, vfsurl, relative);
    }
-
 }

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsjar/Handler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsjar/Handler.java	2007-10-31 20:55:55 UTC (rev 66632)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsjar/Handler.java	2007-10-31 21:09:11 UTC (rev 66633)
@@ -46,6 +46,7 @@
       URL url = new URL(file);
       return new VirtualFileURLConnection(u, url, path);
    }
+
    public static void main(String[] args) throws Exception
    {
       System.setProperty("java.protocol.handler.pkgs", "org.jboss.virtual.protocol");

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsmemory/Handler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsmemory/Handler.java	2007-10-31 20:55:55 UTC (rev 66632)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsmemory/Handler.java	2007-10-31 21:09:11 UTC (rev 66633)
@@ -44,12 +44,14 @@
    {
       String host = u.getHost();
       MemoryContext ctx = MemoryContextFactory.getInstance().find(host);
+      if (ctx == null)
+         throw new IOException("vfs does not exist: " + u.toString());
 
-      if (ctx == null) throw new IOException("vfs does not exist: " + u.toString());
       VirtualFile vf = ctx.findChild(ctx.getRoot(), u.getPath()).getVirtualFile();
-      if (vf == null) throw new IOException("vfs does not exist: " + u.toString());
+      if (vf == null)
+         throw new IOException("vfs does not exist: " + u.toString());
+
       return new VirtualFileURLConnection(u, vf);
-      
    }
 
    public static void main(String[] args) throws Exception

Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/URLConnectionUnitTestCase.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/URLConnectionUnitTestCase.java	2007-10-31 20:55:55 UTC (rev 66632)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/URLConnectionUnitTestCase.java	2007-10-31 21:09:11 UTC (rev 66633)
@@ -34,7 +34,7 @@
     * Test url content
     * @throws Exception for any error
     */
-   public void testFileURLs() throws Exception
+   public void testContent() throws Exception
    {
    }
 }




More information about the jboss-cvs-commits mailing list