You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ca...@apache.org on 2007/02/09 23:33:02 UTC
svn commit: r505535 -
/maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/BundlePlugin.java
Author: carlos
Date: Fri Feb 9 14:33:02 2007
New Revision: 505535
URL: http://svn.apache.org/viewvc?view=rev&rev=505535
Log:
Refactor regex
Modified:
maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/BundlePlugin.java
Modified: maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/BundlePlugin.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/BundlePlugin.java?view=diff&rev=505535&r1=505534&r2=505535
==============================================================================
--- maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/BundlePlugin.java (original)
+++ maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/BundlePlugin.java Fri Feb 9 14:33:02 2007
@@ -327,30 +327,14 @@
}
}
- /* convert 1.string into 1.0.0.string */
- Pattern ONE_NUMBER = Pattern.compile("([0-9])\\.([0-9A-Za-z_-]+)");
- m = ONE_NUMBER.matcher(osgiVersion);
+ /* convert 1.string into 1.0.0.string and 1.2.string into 1.2.0.string */
+ Pattern NEED_TO_FILL_ZEROS = Pattern.compile("([0-9])(\\.([0-9]))?\\.([0-9A-Za-z_-]+)");
+ m = NEED_TO_FILL_ZEROS.matcher(osgiVersion);
if (m.matches()) {
String major = m.group(1);
- String minor = "0";
+ String minor = ( m.group( 3 ) != null ) ? m.group( 3 ) : "0";
String service = "0";
- String qualifier = m.group(2);
-
- Matcher qualifierMatcher = ONLY_NUMBERS.matcher( qualifier );
- /* if last portion is only numbers then it's not a qualifier */
- if (!qualifierMatcher.matches()) {
- osgiVersion = major + "." + minor + "." + service + "." + qualifier;
- }
- }
-
- /* convert 1.2.string into 1.2.0.string */
- Pattern TWO_NUMBER = Pattern.compile("([0-9])\\.([0-9])\\.([0-9A-Za-z_-]+)");
- m = TWO_NUMBER.matcher(osgiVersion);
- if (m.matches()) {
- String major = m.group(1);
- String minor = m.group(2);
- String service = "0";
- String qualifier = m.group(3);
+ String qualifier = m.group(4);
Matcher qualifierMatcher = ONLY_NUMBERS.matcher( qualifier );
/* if last portion is only numbers then it's not a qualifier */