maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r399334 - in /maven/plugins/trunk/maven-release-plugin/src: main/java/org/apache/maven/plugins/release/versions/DefaultVersionInfo.java test/java/org/apache/maven/plugins/release/versions/DefaultVersionInfoTest.java
Date Wed, 03 May 2006 15:28:17 GMT
Author: brett
Date: Wed May  3 08:27:57 2006
New Revision: 399334

URL: http://svn.apache.org/viewcvs?rev=399334&view=rev
Log:
[MRELEASE-90] allow parsing of the version SNAPSHOT.

Modified:
    maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/versions/DefaultVersionInfo.java
    maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/versions/DefaultVersionInfoTest.java

Modified: maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/versions/DefaultVersionInfo.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/versions/DefaultVersionInfo.java?rev=399334&r1=399333&r2=399334&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/versions/DefaultVersionInfo.java
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/versions/DefaultVersionInfo.java
Wed May  3 08:27:57 2006
@@ -183,19 +183,24 @@
 
     public VersionInfo getNextVersion()
     {
-        List digits = new ArrayList( this.digits );
-        String annotationRevision = this.annotationRevision;
-        if ( StringUtils.isNumeric( annotationRevision ) )
+        DefaultVersionInfo version = null;
+        if ( digits != null )
         {
-            annotationRevision = incrementVersionString( annotationRevision );
-        }
-        else
-        {
-            digits.set( digits.size() - 1, incrementVersionString( (String) digits.get( digits.size()
- 1 ) ) );
-        }
+            List digits = new ArrayList( this.digits );
+            String annotationRevision = this.annotationRevision;
+            if ( StringUtils.isNumeric( annotationRevision ) )
+            {
+                annotationRevision = incrementVersionString( annotationRevision );
+            }
+            else
+            {
+                digits.set( digits.size() - 1, incrementVersionString( (String) digits.get(
digits.size() - 1 ) ) );
+            }
 
-        return new DefaultVersionInfo( digits, annotation, annotationRevision, buildSpecifier,
annotationSeparator,
-                                       annotationRevSeparator, buildSeparator );
+            version = new DefaultVersionInfo( digits, annotation, annotationRevision, buildSpecifier,
+                                              annotationSeparator, annotationRevSeparator,
buildSeparator );
+        }
+        return version;
     }
 
     /**
@@ -342,7 +347,7 @@
      */
     protected static String joinDigitString( List digits )
     {
-        return StringUtils.join( digits.iterator(), DIGIT_SEPARATOR_STRING );
+        return digits != null ? StringUtils.join( digits.iterator(), DIGIT_SEPARATOR_STRING
) : null;
     }
 
     /**

Modified: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/versions/DefaultVersionInfoTest.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/versions/DefaultVersionInfoTest.java?rev=399334&r1=399333&r2=399334&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/versions/DefaultVersionInfoTest.java
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/versions/DefaultVersionInfoTest.java
Wed May  3 08:27:57 2006
@@ -50,6 +50,7 @@
     public void testParseSnapshotVersion()
         throws Exception
     {
+        checkParsing( "SNAPSHOT", null, null, null, "SNAPSHOT" );
         checkParsing( "1.0-beta-4-SNAPSHOT", "1.0", "beta", "4", "SNAPSHOT" );
         checkParsing( "1.0-beta-4_SNAPSHOT", "1.0", "beta", "4", "SNAPSHOT" );
     }
@@ -123,6 +124,9 @@
     public void testNextVersion()
         throws Exception
     {
+        VersionInfo v = new DefaultVersionInfo( "SNAPSHOT" );
+        assertNull( v.getNextVersion() );
+
         checkNextVersion( "1", "2" );
         checkNextVersion( "1.01", "1.02" );
         checkNextVersion( "1.9", "1.10" );



Mime
View raw message