From 07e0ba1081a2fc2af3e431259c0c5efd08bc65a6 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 14 Mar 2013 17:06:05 -0700 Subject: [PATCH] Added support for java_exact_version_required. --- .../com/threerings/getdown/data/Application.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/com/threerings/getdown/data/Application.java b/src/main/java/com/threerings/getdown/data/Application.java index 97c5ef3..af152a3 100644 --- a/src/main/java/com/threerings/getdown/data/Application.java +++ b/src/main/java/com/threerings/getdown/data/Application.java @@ -567,6 +567,10 @@ public class Application } } + // check to see if we require a particular JVM version and have a supplied JVM + vstr = (String)cdata.get("java_exact_version_required"); + _javaExactVersionRequired = Boolean.parseBoolean(vstr); + // this is a little weird, but when we're run from the digester, we see a String[] which // contains java locations for all platforms which we can't grok, but the digester doesn't // need to know about that; when we're run in a real application there will be only one! @@ -799,6 +803,17 @@ public class Application int revis = Integer.parseInt(m.group(3)); int patch = m.group(4) == null ? 0 : Integer.parseInt(m.group(4).substring(1)); int version = patch + 100 * (revis + 100 * (minor + 100 * major)); + + if (_javaExactVersionRequired) { + if (version != _javaVersion) { + return true; + } else { + log.warning("An exact Java VM version is required.", "current", version, + "required", _javaVersion); + return false; + } + } + return version >= _javaVersion; } @@ -1672,6 +1687,7 @@ public class Application protected int _trackingId; protected int _javaVersion; + protected boolean _javaExactVersionRequired; protected String _javaLocation; protected List _codes = new ArrayList();