@@ -42,7 +42,7 @@ public class Version implements Comparable<Version>, Serializable {
42
42
private static final long serialVersionUID = 1 ;
43
43
44
44
private static final String VERSION_REGEXP =
45
- "(\\ d+)\\ .(\\ d+)(\\ .\\ d+)?(\\ .\\ d+)?([~\\ -]\\ w[.\\ w]*(?:-\\ w[.\\ w]*)*)?(\\ +[.\\ w]+)?" ;
45
+ "(\\ d+)\\ .(\\ d+)(\\ .(?:rc)? \\ d+)?(\\ .\\ d+)?([~\\ -]\\ w[.\\ w]*(?:-\\ w[.\\ w]*)*)?(\\ +[.\\ w]+)?" ;
46
46
47
47
private static final Pattern pattern = Pattern .compile (VERSION_REGEXP );
48
48
@@ -100,8 +100,9 @@ public static Version parse(@Nullable String version) {
100
100
int minor = Integer .parseInt (matcher .group (2 ));
101
101
102
102
String pa = matcher .group (3 );
103
+ boolean isRC = pa != null && pa .startsWith (".rc" ); // Detect Scylla naming convention: X.Y.rcZ
103
104
int patch =
104
- pa == null || pa .isEmpty ()
105
+ pa == null || pa .isEmpty () || isRC
105
106
? 0
106
107
: Integer .parseInt (
107
108
pa .substring (1 )); // dropping the initial '.' since it's included this time
@@ -115,10 +116,12 @@ public static Version parse(@Nullable String version) {
115
116
116
117
String pr = matcher .group (5 );
117
118
String [] preReleases =
118
- pr == null || pr .isEmpty ()
119
- ? null
120
- : pr .substring (1 )
121
- .split ("-" ); // drop initial '-' or '~' then split on the remaining ones
119
+ isRC
120
+ ? new String [] {pa .substring (1 )}
121
+ : pr == null || pr .isEmpty ()
122
+ ? null
123
+ : pr .substring (1 )
124
+ .split ("-" ); // drop initial '-' or '~' then split on the remaining ones
122
125
123
126
String bl = matcher .group (6 );
124
127
String build = bl == null || bl .isEmpty () ? null : bl .substring (1 ); // drop the initial '+'
0 commit comments