"jason.greene(a)jboss.com" wrote :
| So to truly solve this issue, vfs urls would need to be completely logical, and have
no distinguishing difference between an exploded directory and a compressed jar. Those
really are physical aspects.
|
| Which seems to indicate that Ales' consistent use of / on non-leaf urls is the
correct approach.
I'm not sure it solves the real problem, but it would certainly provide a consistent
basis on which it could be solved.
The problem as currently described by Ales is that adding a "/" helps
webapps/libraries
that naturally expect their directories to be unpacked (most webservers do it)
so the directory urls will always end with /
Carlo's code is expecting his persistent units to be packed in jars.
In practice, both are wrong and both should take more care when processing urls.
So we can do it one way or the other in the VFS, the / on the end is more logical
but its bound to break somebody else's code besides jpa (and vice versa).
The fix to Carlo's code is one of:
1) Use the VFS (which will work however Ales changes the URLs)
| -URL url = di.getFile("").toURL();
| -return new URL(url, jar);
| + VirtualFile di = di.getFile("");
| + return di.getParent().getChild(jar).toURL(); // Obviously needs to check for null
|
2) Handle the URLs correctly
| URL url = di.getFile("").toURL();
| +if (url.getPath().endsWith('/')
| + return new URL(url, "../" + jar);
| return new URL(url, jar);
|
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4211271#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...