Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1004: Skara bots fail to parse openjfx11.0.12 version #1142

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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