Uploaded image for project: 'JBoss VFS'
  1. JBoss VFS
  2. JBVFS-182

Access of URLs with jar:file: scheme causes an NPE when setting -Djboss.vfs.forceCanonical=true

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 2.2.0.GA, 2.2.0.SP1
    • Release
    • Hide

      Add the following to SymlinkTestCase.java:

      SymlinkTestCase.java
         public void testJarFileScheme() throws Exception
         {   
            URL url = getResource("/vfs/test/level1.zip");
            try 
            {   
              VFS vfs = VFS.getVFS(new URL("jar:file:" + url.getPath() + "!/" + "level2.zip/level3.zip"));
            }   
            catch(NullPointerException npe)
            {   
              failure("NPE thrown because jar:file: not handled by canonicalization code.", npe);
            }   
         }
      
      Show
      Add the following to SymlinkTestCase.java: SymlinkTestCase.java public void testJarFileScheme() throws Exception { URL url = getResource( "/vfs/test/level1.zip" ); try { VFS vfs = VFS.getVFS( new URL( "jar:file:" + url.getPath() + "!/" + "level2.zip/level3.zip" )); } catch (NullPointerException npe) { failure( "NPE thrown because jar:file: not handled by canonicalization code." , npe); } }

      Accessing a jar:file: URL causes an NPE if -Djboss.vfs.forceCanonical=true

      Add the following to SymlinkTestCase.java:

      SymlinkTestCase.java
         public void testJarFileScheme() throws Exception
         {   
            URL url = getResource("/vfs/test/level1.zip");
            try 
            {   
              VFS vfs = VFS.getVFS(new URL("jar:file:" + url.getPath() + "!/" + "level2.zip/level3.zip"));
            }   
            catch(NullPointerException npe)
            {   
              failure("NPE thrown because jar:file: not handled by canonicalization code.", npe);
            }   
         }
      

      Results in:

      testJarFileScheme(org.jboss.test.virtual.test.SymlinkTestCase)  Time elapsed: 0.015 sec  <<< FAILURE!
      junit.framework.AssertionFailedError: NPE thrown because jar:file: not handled by canonicalization code.
      ...
      <snip>
      ...
      Caused by: java.lang.NullPointerException
        at java.io.File.<init>(File.java:222)
        at org.jboss.virtual.plugins.registry.DefaultVFSRegistry.canonicalize(DefaultVFSRegistry.java:124)
        at org.jboss.virtual.plugins.registry.DefaultVFSRegistry.getContext(DefaultVFSRegistry.java:144)
        at org.jboss.virtual.VFS.getVFS(VFS.java:203)
        at org.jboss.virtual.VFS.getVFS(VFS.java:184)
        at org.jboss.virtual.VFS.getVFS(VFS.java:287)
        at org.jboss.test.virtual.test.SymlinkTestCase.testJarFileScheme(SymlinkTestCase.java:174)
      

              ajustin@redhat.com Ales Justin
              rhn-support-csams Christopher Sams
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: