mcconnell 2003/07/12 09:49:56
Modified: framework/src/api/org/apache/avalon/framework Version.java
framework/src/test/org/apache/avalon/framework/test
VersionTestCase.java
Log:
Update the version compliance testing such a concrete version e.g. 3.2.1(something)
is compliant with -1.0.0 (anything), but -1.0.0 (anything) is not compliant with a
3.2.1 (something). I.e. something is not compliant with anything but anything is
compliant with something ;-)
Revision Changes Path
1.30 +2 -8
avalon/framework/src/api/org/apache/avalon/framework/Version.java
Index: Version.java
===================================================================
RCS file:
/home/cvs/avalon/framework/src/api/org/apache/avalon/framework/Version.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- Version.java 12 Jul 2003 07:32:57 -0000 1.29
+++ Version.java 12 Jul 2003 16:49:55 -0000 1.30
@@ -117,12 +117,6 @@
levels[ i ] = tokenizer.nextToken();
}
- //if( 0 == levels.length || 3 < levels.length )
- //{
- // throw new IllegalArgumentException( "Malformed version string '" +
version + "'." );
- //}
- //final int major = Integer.parseInt( levels[ 0 ] );
-
int major = -1;
if( 0 < levels.length )
{
@@ -290,7 +284,7 @@
*/
public boolean complies( final Version other )
{
- if( m_major == -1 )
+ if( other.m_major == -1 )
{
return true;
}
1.10 +4 -2
avalon/framework/src/test/org/apache/avalon/framework/test/VersionTestCase.java
Index: VersionTestCase.java
===================================================================
RCS file:
/home/cvs/avalon/framework/src/test/org/apache/avalon/framework/test/VersionTestCase.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- VersionTestCase.java 12 Jul 2003 15:54:19 -0000 1.9
+++ VersionTestCase.java 12 Jul 2003 16:49:56 -0000 1.10
@@ -109,8 +109,10 @@
final Version v3 = new Version( 1, 4 , 0 );
final Version v4 = new Version( 2, 0 , 1 );
- assertTrue( v0.complies( v1 ) );
- assertTrue( v0.complies( v4 ) );
+ assertTrue( v1.complies( v0 ) );
+ assertTrue( v4.complies( v0 ) );
+ assertTrue( ! v0.complies( v1 ) );
+ assertTrue( ! v0.complies( v4 ) );
assertTrue( v1.complies( v1 ) );
assertTrue( ! v1.complies( v2 ) );
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]