bloritsch 2003/05/29 13:23:00
Modified: fortress/src/tools/org/apache/avalon/fortress/tools
Component.java
Log:
Fix error where classes in the same package were not concidered.
Revision Changes Path
1.11 +26 -15
avalon-excalibur/fortress/src/tools/org/apache/avalon/fortress/tools/Component.java
Index: Component.java
===================================================================
RCS file:
/home/cvs/avalon-excalibur/fortress/src/tools/org/apache/avalon/fortress/tools/Component.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Component.java 29 May 2003 19:56:23 -0000 1.10
+++ Component.java 29 May 2003 20:23:00 -0000 1.11
@@ -373,28 +373,39 @@
{
if ( className.indexOf( '.' ) < 0 )
{
- String[] imports = sourceCode.getImports();
+ className = checkPackage(sourceCode, sourceCode.getPackage(),
serviceName);
- for ( int t = 0; t < imports.length; t++ )
+ if ( className.equals(serviceName) )
{
- final String type = imports[t];
- final String tail = type.substring( type.lastIndexOf( '.' ) + 1
);
-
- if ( tail.equals( className ) )
- {
- className = type;
- }
- else if ( tail.equals( "*" ) )
+ String[] imports = sourceCode.getImports();
+ for ( int t = 0; t < imports.length; t++ )
{
- final String pack = type.substring( 0, type.lastIndexOf(
'.' ) );
- final JavaClass klass =
sourceCode.getClassLibrary().getClassByName( pack + "." + serviceName );
- if ( null != klass )
- className = klass.getFullyQualifiedName();
+ final String type = imports[t];
+ final String tail = type.substring( type.lastIndexOf( '.' )
+ 1 );
+
+ if ( tail.equals( className ) )
+ {
+ className = type;
+ }
+ else if ( tail.equals( "*" ) )
+ {
+ final String pack = type.substring( 0,
type.lastIndexOf( '.' ) );
+ className = checkPackage( sourceCode, pack, serviceName
);
+ }
}
}
}
}
+ return className;
+ }
+
+ private String checkPackage( final JavaSource sourceCode, final String pack,
final String serviceName )
+ {
+ String className = serviceName;
+ final JavaClass klass = sourceCode.getClassLibrary().getClassByName( pack +
"." + serviceName );
+ if ( null != klass )
+ className = klass.getFullyQualifiedName();
return className;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]