Fix for failed to parse versions like 2.3.1-git3282e51 29/15829/1
authorSam Hague <shague@redhat.com>
Fri, 27 Feb 2015 16:50:52 +0000 (11:50 -0500)
committerSam Hague <shague@redhat.com>
Fri, 27 Feb 2015 16:50:52 +0000 (11:50 -0500)
Existing code was matching using the pattern major.minor.patch and would fail if anythign extra was in the string. This was because the code used an exact match across the whole string. Chaning to only find the major.minor.patch pattern fixes the issue by ingoring the extra characters.

Change-Id: I1cefb545bdc571a18727851a791a47a6c6158afa
Signed-off-by: Sam Hague <shague@redhat.com>
library/src/main/java/org/opendaylight/ovsdb/lib/notation/Version.java

index 8298ebca2b0bdc1032185f0fc67142e6b9538d24..fc72f39743a7090030e8eac077a3df93b1d13638 100644 (file)
@@ -38,7 +38,7 @@ public class Version implements Comparable<Version> {
 
     public static Version fromString(String version){
         final Matcher matcher = Version.PATTERN.matcher(version);
-        if (!matcher.matches()) {
+        if (!matcher.find()) {
             throw new IllegalArgumentException("<"+version+"> does not match format "+Version.FORMAT);
         }
         int major = Integer.valueOf(matcher.group(1));