aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/src/main/java/org/aspectj/util/LangUtil.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/util/src/main/java/org/aspectj/util/LangUtil.java b/util/src/main/java/org/aspectj/util/LangUtil.java
index 02aa7d94b..7151c092b 100644
--- a/util/src/main/java/org/aspectj/util/LangUtil.java
+++ b/util/src/main/java/org/aspectj/util/LangUtil.java
@@ -96,16 +96,17 @@ public class LangUtil {
private static List<Integer> getJavaMajorMinor(String vm) {
List<Integer> result = new ArrayList<>();
// Can be something like '1.5', '11.0.16.1', '19+36-2238'
- StringTokenizer st = new StringTokenizer(vm,".-_+");
+ StringTokenizer st = new StringTokenizer(vm.replaceFirst("[+].*", ""), ".-_");
try {
result.add(Integer.parseInt(st.nextToken()));
- // FIXME: The minor will be wrong for version strings like '19+36-2238'.
- // The minor is only relevant for Java <= 1.8. Even so, this is super ugly.
result.add(Integer.parseInt(st.nextToken()));
} catch (Exception e) {
// NoSuchElementException if no more tokens
// NumberFormatException if not a number
}
+ // Always add a default minor, just in case a caller expects it
+ if (result.size() == 1)
+ result.add(0);
return result;
}