[jboss-dev-forums] [Design of POJO Server] - Re: Regression on VirtualFile.toURL()

alesj do-not-reply at jboss.com
Thu Feb 19 05:50:05 EST 2009


"wolfc" wrote : 
  | The first construct doesn't work if the deployment unit base is the VFS root. Then there is no parent.
  | 
  | I could do the following to eliminate the no parent problem:
What about if you just do a simple check?

  |             VFSDeploymentUnit parent = di.getParent();
  |             if (parent != null)
  |             {
  |                VirtualFile parentRoot = parent.getRoot();
  |                return parentRoot.findChild(jar).toURL();
  |             }
  |             else
  |             {
  |                URL url = di.getRoot().toURL();
  |                if (url.getPath().endsWith("/"))
  |                {
  |                   return new URL(url, "../" + jar);
  |                }
  |                else
  |                {
  |                   return new URL(url, jar);
  |                }
  |                
  |             }
  | 

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

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



More information about the jboss-dev-forums mailing list