mcconnell 2003/07/12 09:12:40
Modified: meta/api/src/java/org/apache/avalon/meta/info
ReferenceDescriptor.java
Log:
Fixed the composite type:version handling.
Revision Changes Path
1.8 +21 -2
avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/ReferenceDescriptor.java
Index: ReferenceDescriptor.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/ReferenceDescriptor.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ReferenceDescriptor.java 12 Jul 2003 13:34:27 -0000 1.7
+++ ReferenceDescriptor.java 12 Jul 2003 16:12:38 -0000 1.8
@@ -94,6 +94,7 @@
* @param classname the name of the service
* @param version the version of service
* @exception NullPointerException if the classname or version is null
+ * @exception IllegalArgumentException if the classname string is invalid
*/
public ReferenceDescriptor( final String classname,
final Version version ) throws NullPointerException
@@ -102,6 +103,14 @@
{
throw new NullPointerException( "classname" );
}
+ if( classname.equals( "" ) )
+ {
+ throw new IllegalArgumentException( "classname" );
+ }
+ if( classname.indexOf( "/" ) > -1 )
+ {
+ throw new IllegalArgumentException( "classname" );
+ }
m_classname = classname;
@@ -195,7 +204,17 @@
private static final String parseClassname( final String type )
{
- return type.substring(0, getColonIndex( type ) );
+ if( type == null ) throw new NullPointerException( "type" );
+
+ int index = type.indexOf( ":" );
+ if( index == -1 )
+ {
+ return type;
+ }
+ else
+ {
+ return type.substring( 0, index );
+ }
}
private static final Version parseVersion( final String type )
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]