[
https://jira.jboss.org/jira/browse/JBCL-43?page=com.atlassian.jira.plugin...
]
Stan Silvert commented on JBCL-43:
----------------------------------
When Seam starts up, it will log a message with the version that should say:
"Welcome to Seam 2.1.0-SNAPSHOT"
To get the version, Seam is calling
org.jboss.Seam.getPackage().getImplementationVersion()
If you deploy the attached ear, it will say:
"Welcome to Seam from numberguess jar" This is because it got the
implementation version from the wrong jar.
If you apply the attached patch from the root of the classloading-vfs subproject, the
problem goes away.
PackageInformation retrieved from wrong jar
-------------------------------------------
Key: JBCL-43
URL:
https://jira.jboss.org/jira/browse/JBCL-43
Project: JBoss ClassLoader
Issue Type: Bug
Components: ClassLoaderPolicy, VFS
Affects Versions: JBossCL.2.0.0.GA
Reporter: Stan Silvert
Attachments: jboss-seam-numberguess.ear, patch.diff
I have an ear with these two files in the root:
jboss-seam.jar
jboss-seam-booking.jar
I want to get package info such as Implementation-Version from the class
org.jboss.seam.Seam, which is in jboss-seam.jar. However,
Seam.class.getPackage().getImplementationVersion() returns the version from the manifest
in jboss-seam-booking.jar.
I found that the problem is in VFSClassLoaderPolicy. getPackageInformation() will call
findRoot("org/jboss/seam"). But it happens to look in jboss-seam-booking.jar
first. So it finds classes with the package org.jboss.seam.booking and returns the
package info from the wrong jar.
This change to VFSClassLoaderPolicy.findVirtualFileInfo() fixes the problem:
protected VirtualFileInfo findVirtualFileInfo(String path)
{
VirtualFileInfo result = vfsCache.get(path);
if (result != null)
return result;
for (VirtualFile root : roots)
{
try
{
VirtualFile file = root.getChild(path);
if (file != null)
{
// Must either be a file...
if (file.isLeaf())
{
result = new VirtualFileInfo(file, root);
vfsCache.put(path, result);
return result;
}
// ... or have a child that is a file
for (VirtualFile child : file.getChildren())
{
if (!child.isLeaf()) continue;
result = new VirtualFileInfo(file, root);
vfsCache.put(path, result);
return result;
}
}
}
catch (Exception ignored)
{
}
}
return null;
}
I didn't want to commit this without someone else looking at it. There are two
concerns:
1) Searching all the children might have a performance impact?
2) Would this cause a problem for other code paths that use findVirtualFileInfo()?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira