felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r484698 - /incubator/felix/trunk/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiJarMojo.java
Date Fri, 08 Dec 2006 19:06:06 GMT
Author: rickhall
Date: Fri Dec  8 11:06:03 2006
New Revision: 484698

URL: http://svn.apache.org/viewvc?view=rev&rev=484698
Log:
Slightly improved version of previous version number conversion patch,
submitted by Steven Harris.

Modified:
    incubator/felix/trunk/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiJarMojo.java

Modified: incubator/felix/trunk/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiJarMojo.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiJarMojo.java?view=diff&rev=484698&r1=484697&r2=484698
==============================================================================
--- incubator/felix/trunk/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiJarMojo.java
(original)
+++ incubator/felix/trunk/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiJarMojo.java
Fri Dec  8 11:06:03 2006
@@ -692,16 +692,14 @@
         if (!matcher.lookingAt())
             return version;
 
-        final StringBuffer sb = new StringBuffer(version.length());
+        // Leave extra space for worst-case additional insertion:
+        final StringBuffer sb = new StringBuffer(version.length() + 4);
         sb.append(matcher.group(1));
 
-        int count = 0;
-        for ( int i = matcher.groupCount(); i != 0; --i )
-            if ( null != matcher.group( i ) )
-                ++count;
-
-        if ( 3 != count )
-            sb.append(versionCompleters[count - 1]);
+        if (null == matcher.group(3)) {
+           final int count = null != matcher.group(2) ? 2 : 1;
+           sb.append(versionCompleters[count - 1]);
+        }
 
         sb.append('.');
         sb.append(version.substring(matcher.end(), version.length()));



Mime
View raw message