[jboss-cvs] JBossAS SVN: r67953 - trunk/server/src/main/org/jboss/deployment.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Dec 5 13:25:24 EST 2007
Author: adrian at jboss.org
Date: 2007-12-05 13:25:23 -0500 (Wed, 05 Dec 2007)
New Revision: 67953
Modified:
trunk/server/src/main/org/jboss/deployment/AnnotatedClassFilter.java
Log:
Fix the problem of getting the classname wrong when the root path is empty
Modified: trunk/server/src/main/org/jboss/deployment/AnnotatedClassFilter.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/AnnotatedClassFilter.java 2007-12-05 18:24:36 UTC (rev 67952)
+++ trunk/server/src/main/org/jboss/deployment/AnnotatedClassFilter.java 2007-12-05 18:25:23 UTC (rev 67953)
@@ -48,6 +48,7 @@
private static Logger log = Logger.getLogger(AnnotatedClassFilter.class);
private ClassLoader loader;
private VirtualFile classpathRoot;
+ private int rootLength;
private HashSet<String> childPaths = new HashSet<String>();
private HashMap<VirtualFile, Class<?>> pathToClasses = new HashMap<VirtualFile, Class<?>>();
@@ -55,6 +56,12 @@
{
this.loader = loader;
this.classpathRoot = classpathRoot;
+
+ // Work out the root length. If there is a root, we need to add one to jump across the next /
+ String rootName = classpathRoot.getPathName();
+ rootLength = rootName.length();
+ if (rootLength > 0)
+ rootLength += 1;
List<DeploymentUnit> children = unit.getChildren();
if(children != null)
{
@@ -147,8 +154,7 @@
throws IOException
{
String pathName = classFile.getPathName();
- String rootPath = classpathRoot.getPathName();
- String name = pathName.substring(rootPath.length()+1, pathName.length()-6);
+ String name = pathName.substring(rootLength, pathName.length()-6);
name = name.replace('/', '.');
return name;
}
More information about the jboss-cvs-commits
mailing list