From 6cd989e534dd52130f932ce04d3ca8aafe387cc9 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Sat, 9 Dec 2017 19:29:09 +0100 Subject: [PATCH] deal with theoretical case of version scheme changing again --- src/main/org/apache/tools/ant/util/JavaEnvUtils.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/org/apache/tools/ant/util/JavaEnvUtils.java b/src/main/org/apache/tools/ant/util/JavaEnvUtils.java index 7c980c89e..359174a75 100644 --- a/src/main/org/apache/tools/ant/util/JavaEnvUtils.java +++ b/src/main/org/apache/tools/ant/util/JavaEnvUtils.java @@ -187,8 +187,12 @@ public final class JavaEnvUtils { javaVersionNumber = VERSION_9; // at least Java9 and this should properly support the purely numeric version property String v = System.getProperty("java.specification.version"); - javaVersionNumber = Integer.parseInt(v) * 10; - javaVersion = v; + DeweyDecimal pv = new DeweyDecimal(v); + javaVersionNumber = pv.get(0) * 10; + if (pv.getSize() > 1) { + javaVersionNumber += pv.get(1); + } + javaVersion = pv.toString(); } catch (Throwable t) { // swallow as we've hit the max class version that // we have