[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: JarEntry as VFS root does not return empty vfspath

adrian@jboss.org do-not-reply at jboss.com
Wed Mar 26 05:12:12 EDT 2008


"mstruk" wrote : 
  | This is our context URI:
  | 
  | file:/vfs/test/outer.jar!/org/jboss/test/vfs/support
  | 
  | These are parent child relationships for handlers within JarContext:
  | 
  | 
  | null
  |   JarHandler (represents: file:/vfs/test/outer.jar)
  |      JarEntryHandler (represents org)
  |         JarEntryHandler (represents jboss)
  |            JarEntryHandler (represents test)
  |               JarEntryHandler (represents vfs)
  | root =           JarEntryHandler (represents support)
  |                     JarEntryHandler (represents CommonClass.class)
  |                     JarEntryHandler (represents jar1)
  |                     JarEntryHandler (represents jar2)
  | 
  | 
  | root handler has VF handler representing 'vfs' for its parent. getParent().getParent() returns VF handler representing 'test'.
  | 
  | 
  | The solution would be to set root's parent to null.
  | 

Ok so the problem is that whatever is creating the JAR VFS
is letting you leak off the top when you create a VFS based on a jar entry
all the way back to the jar file.

In fact, the code says it is a hack in JarContext

  |    protected VirtualFileHandler createVirtualFileHandler(VirtualFileHandler parent, URL url) throws IOException
  |    {
  |       if (url == null)
  |          throw new IllegalArgumentException("Null url");
  | 
  |       String urlStr = url.toString();
  |       String jarName = extractJarName(urlStr);
  |       String entryPath = urlStr;
  |       entryPath = entryPath(entryPath);
  |       JarHandler jar =  new JarHandler(this, parent, url, jarName);
  |       if (entryPath == null)
  |          return jar;
  |       
  |       // todo This is a hack until we can fix http://jira.jboss.com/jira/browse/JBMICROCONT-164
  |       AbstractVirtualFileHandler result = (AbstractVirtualFileHandler)jar.getChild(entryPath);
  |       result.setPathName("");
  |       return result;
  |    }
  | 

The issue has been around for a year. ;-)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138892#4138892

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138892



More information about the jboss-dev-forums mailing list