Skip to content
Permalink
Browse files
1004: Skara bots fail to parse openjfx11.0.12 version
Reviewed-by: rwestberg, tbell
  • Loading branch information
erikj79 committed Apr 29, 2021
1 parent 7b3d557 commit d27723d1484cc6e1c658dd3b8d7c226e3de12033
Showing 2 changed files with 19 additions and 0 deletions.
@@ -38,6 +38,8 @@ public class JdkVersion implements Comparable<JdkVersion> {
private final static Pattern ojVersionPattern = Pattern.compile("(openjdk[1-9][0-9]?)(u([0-9]{1,3}))?$");
private final static Pattern fxVersionPattern = Pattern.compile("(openjfx[1-9][0-9]?)(u([0-9]{1,3}))?$");

private final static Pattern prefixPattern = Pattern.compile("([a-z]+)([0-9.]+)$");

private final static Pattern legacyPrefixPattern = Pattern.compile("^([^\\d]*)\\d+$");

private static List<String> splitComponents(String raw) {
@@ -63,6 +65,12 @@ private static List<String> splitComponents(String raw) {
optional = raw.substring(optionalStart + 1);
raw = raw.substring(0, optionalStart);
}
var prefixMatcher = prefixPattern.matcher(raw);
String prefix = null;
if (prefixMatcher.matches()) {
prefix = prefixMatcher.group(1);
raw = prefixMatcher.group(2);
}

finalComponents.addAll(Arrays.asList(raw.split("\\.")));

@@ -73,6 +81,10 @@ private static List<String> splitComponents(String raw) {
finalComponents.add(null);
finalComponents.add(optional);
}

if (prefix != null) {
finalComponents.set(0, prefix + finalComponents.get(0));
}
}

return finalComponents;
@@ -65,6 +65,12 @@ void legacy() {
assertEquals(List.of("openjdk8", "211"), from("openjdk8u211").components());
}

@Test
void openjfx11() {
assertEquals(List.of("openjfx11", "0", "12"), from("openjfx11.0.12").components());
assertEquals(List.of("openjfx17", "3", "4", "5", "6"), from("openjfx17.3.4.5.6").components());
}

@Test
void order() {
assertEquals(0, from("5.0u45").compareTo(from("5.0u45")));
@@ -83,6 +89,7 @@ void order() {
assertEquals(-1, from("emb-8u71").compareTo(from("emb-8u170")));
assertEquals(-1, from("openjdk7").compareTo(from("openjdk7u42")));
assertEquals(-1, from("hs22.4").compareTo(from("hs23")));
assertEquals(-1, from("openjfx11.0.12").compareTo(from("openjfx17.3.4.5.6")));
}

@Test

1 comment on commit d27723d

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on d27723d Apr 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.