[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: vfsmemory url problem

alesj do-not-reply at jboss.com
Wed Aug 20 05:19:20 EDT 2008


"alesj" wrote : And even if you got past this,
  | it's still wrong, since /classes/ part is then never used.
  | MemoryContextFactory.java:
  | 
  |   |    public VFSContext createRoot(URL url)
  |   |    {
  |   |       try
  |   |       {
  |   |          String rootName = url.getHost();
  |   |          MemoryContext ctx = registry.get(rootName);
  |   |          if (ctx == null)
  |   |          {
  |   |             String urlPath = url.getPath();
  |   |             if (urlPath != null && urlPath.length() > 0)
  |   |                throw new IllegalArgumentException("Root can not contain '/' - " + urlPath);
  |   | 
  |   |             URL ctxURL = new URL("vfsmemory://" + rootName);
  |   |             ctx = new MemoryContext(ctxURL);
  |   |             registry.put(rootName, ctx);
  |   |          }
  |   |          return ctx;
  |   | 
  | 
I reverted this url path check move.

  |    public VFSContext createRoot(URL url)
  |    {
  |       try
  |       {
  |          String urlPath = url.getPath();
  |          if (urlPath != null && urlPath.length() > 0)
  |             throw new IllegalArgumentException("Root url cannot contain path - " + urlPath);
  | 
It's illegal to pass in url with path,
when you need root.
Since with the previous code,
you wouldn't get what you expected - /classes/ get ignored,
hence pointing to the wrong VirtualFile,
if this url was used as VFS.getRoot().

But now I get vfslink test failures - due to wrong assumption.
So, Marko, these tests need fixing.

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

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



More information about the jboss-dev-forums mailing list