Return-Path: Delivered-To: apmail-maven-commits-archive@www.apache.org Received: (qmail 47059 invoked from network); 3 May 2006 15:31:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 May 2006 15:31:05 -0000 Received: (qmail 95027 invoked by uid 500); 3 May 2006 15:29:52 -0000 Delivered-To: apmail-maven-commits-archive@maven.apache.org Received: (qmail 94948 invoked by uid 500); 3 May 2006 15:29:52 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 94915 invoked by uid 99); 3 May 2006 15:29:52 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 May 2006 08:29:52 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 03 May 2006 08:29:51 -0700 Received: (qmail 45398 invoked by uid 65534); 3 May 2006 15:28:54 -0000 Message-ID: <20060503152853.45258.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@maven.apache.org From: brett@apache.org X-Mailer: svnmailer-1.0.8 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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" );