[jboss-cvs] JBossAS SVN: r91618 - projects/spring-int/branches/1_0/vfs/src/main/java/org/jboss/spring/vfs.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 23 15:32:50 EDT 2009


Author: marius.bogoevici
Date: 2009-07-23 15:32:50 -0400 (Thu, 23 Jul 2009)
New Revision: 91618

Modified:
   projects/spring-int/branches/1_0/vfs/src/main/java/org/jboss/spring/vfs/VFSResourceLoader.java
Log:
Merging the classpath: fix from trunk.

Modified: projects/spring-int/branches/1_0/vfs/src/main/java/org/jboss/spring/vfs/VFSResourceLoader.java
===================================================================
--- projects/spring-int/branches/1_0/vfs/src/main/java/org/jboss/spring/vfs/VFSResourceLoader.java	2009-07-23 18:49:50 UTC (rev 91617)
+++ projects/spring-int/branches/1_0/vfs/src/main/java/org/jboss/spring/vfs/VFSResourceLoader.java	2009-07-23 19:32:50 UTC (rev 91618)
@@ -37,55 +37,60 @@
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  */
 public class VFSResourceLoader extends DefaultResourceLoader
-{    
-   public VFSResourceLoader(ClassLoader classLoader)
-   {
-      super(classLoader);
-   }
+{
+    public VFSResourceLoader(ClassLoader classLoader) 
+    {
+        super(classLoader);
+    }
 
-   public Resource getResource(String location)
-   {
-      Assert.notNull(location, "Location must not be null");
-      if (location.startsWith(CLASSPATH_URL_PREFIX))
-      {
-         return getResourceByPath(location.substring(CLASSPATH_URL_PREFIX.length()));
-      }
-      else
-      {
-         return super.getResource(location);
-      }
-   }
+    public Resource getResource(String location)
+    {
+        Assert.notNull(location, "Location must not be null");
+        if (location.startsWith(CLASSPATH_URL_PREFIX))
+        {
+            return doGetResourceForLocation(location.substring(CLASSPATH_URL_PREFIX.length()));
+        } else
+        {
+            return super.getResource(location);
+        }
+    }
 
-   protected Resource getResourceByPath(String path)
-   {
-      URL url = getClassLoader().getResource(path);
-      if (url != null)
-         return new VFSResource(url);
-      else
-         return new InexistentResource(path);
-   }
+    protected Resource getResourceByPath(String path)
+    {
+        return doGetResourceForLocation(path);
+    }
 
-   /* A special type of resource, for the case when the resource does not exit */
-   private static class InexistentResource extends AbstractResource
-   {
-      private final String path;
+    private final Resource doGetResourceForLocation(String path) {
+        URL url = getClassLoader().getResource(path);
+        if (url != null)
+            return new VFSResource(url);
+        else
+            return new InexistentResource(path);
+    }
 
-       private InexistentResource(String path) {
-           this.path = path;
-       }
+    /* A special type of resource, for the case when the resource does not exit */
+    private static class InexistentResource extends AbstractResource
+    {
+        private final String path;
 
-       public String getDescription()
-      {
-         return null;
-      }
+        private InexistentResource(String path)
+        {
+            this.path = path;
+        }
 
-      public InputStream getInputStream() throws IOException
-      {
-         throw new FileNotFoundException("Resource does not exist for path " + path);
-      }
+        public String getDescription()
+        {
+            return null;
+        }
 
-      public boolean exists() {
-         return false;
-      }
+        public InputStream getInputStream() throws IOException
+        {
+            throw new FileNotFoundException("Resource does not exist for path " + path);
+        }
+
+        public boolean exists()
+        {
+            return false;
+        }
     }
 }
\ No newline at end of file




More information about the jboss-cvs-commits mailing list