Wrong separator for Jarrchives
------------------------------
Key: XBEAN-193
URL: https://issues.apache.org/jira/browse/XBEAN-193
Project: XBean
Issue Type: Bug
Components: finder
Affects Versions: 3.8, 3.9
Environment: Windows,
OpenEjb 4.0.0-beta-2-SNAPSHOT (using XBean 3.8)
Reporter: Mart Köhler
Priority: Minor
Hello everybody,
Problem:
I'm using Apache TomEE from OpenEjb 4.0.0-beta-2-SNAPSHOT which uses the within
the openejb-core the xbean-finder (3.8) for classloading purposes.
I created a web archive which has a simple dependency to a jar. I defined an
injectionpoint within a servlet. This injectionpoint points to a class which is
located within the jar archive. The deployment of the web archive fails with an
unsatisfied dependency exception because classloader isn't able to load the
classes from the jar.
I've found out that the JarArchive class (package
org.apache.xbean.finder.archive) uses "File.separatorChar" in order to replace
"." within the private method addClassName.
As I know, the separator within a jar entry has to be '/'. "File.separatorChar"
returns on a windows machine '\' instead. This behaviour causes the deployment
problem.
Solution:
Instead of (JarArchive):
className = className.replace(File.separatorChar, '.');
it has to look something like this:
className = className.replace('/', '.');
The Archive class (org.apache.xbean.finder.archive) has to be changed for the
unit tests
Instead of:
String name = clazz.getName().replace('.', File.separatorChar) + ".class";
we need something like this:
String name = clazz.getName().replace('.', '/') + ".class";
Best regards,
Mart Köhler
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira