deal with theoretical case of version scheme changing again
Project: http://git-wip-us.apache.org/repos/asf/ant/repo Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/6cd989e5 Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/6cd989e5 Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/6cd989e5 Branch: refs/heads/master Commit: 6cd989e534dd52130f932ce04d3ca8aafe387cc9 Parents: 4ea3946 Author: Stefan Bodewig <[email protected]> Authored: Sat Dec 9 19:29:09 2017 +0100 Committer: Stefan Bodewig <[email protected]> Committed: Sat Dec 9 19:29:09 2017 +0100 ---------------------------------------------------------------------- src/main/org/apache/tools/ant/util/JavaEnvUtils.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ant/blob/6cd989e5/src/main/org/apache/tools/ant/util/JavaEnvUtils.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/util/JavaEnvUtils.java b/src/main/org/apache/tools/ant/util/JavaEnvUtils.java index 7c980c8..359174a 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
