Changeset 12238 in josm


Ignore:
Timestamp:
2017-05-23T01:25:33+02:00 (8 years ago)
Author:
Don-vip
Message:

see #11924 - make the JRE expiration date detection system work with Java 9

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/build.xml

    r12237 r12238  
    144144                <attribute name="Application-Name" value="JOSM - Java OpenStreetMap Editor"/>
    145145                <!-- Java 9 stuff. Entries are safely ignored by Java 8 -->
    146                 <attribute name="Add-Exports" value="java.base/sun.security.util java.base/sun.security.x509" />
     146                <attribute name="Add-Exports" value="java.base/sun.security.util java.base/sun.security.x509 jdk.deploy/com.sun.deploy.config" />
    147147                <attribute name="Add-Opens" value="java.desktop/javax.swing.text.html java.prefs/java.util.prefs" />
    148148            </manifest>
     
    444444                    <jvmarg value="--add-exports" if:set="isJava9" />
    445445                    <jvmarg value="java.base/sun.security.x509=ALL-UNNAMED" if:set="isJava9" />
     446                    <jvmarg value="--add-exports" if:set="isJava9" />
     447                    <jvmarg value="jdk.deploy/com.sun.deploy.config=ALL-UNNAMED" if:set="isJava9" />
    446448                    <jvmarg value="--add-opens" if:set="isJava9" />
    447449                    <jvmarg value="java.base/java.io=ALL-UNNAMED" if:set="isJava9" />
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r12219 r12238  
    16571657    public static Date getJavaExpirationDate() {
    16581658        try {
    1659             Object value = Class.forName("com.sun.deploy.config.BuiltInProperties").getDeclaredField("JRE_EXPIRATION_DATE").get(null);
     1659            Object value = null;
     1660            Class<?> c = Class.forName("com.sun.deploy.config.BuiltInProperties");
     1661            try {
     1662                value = c.getDeclaredField("JRE_EXPIRATION_DATE").get(null);
     1663            } catch (NoSuchFieldException e) {
     1664                // Field is gone with Java 9, there's a method instead
     1665                Main.trace(e);
     1666                value = c.getDeclaredMethod("getProperty", String.class).invoke(null, "JRE_EXPIRATION_DATE");
     1667            }
    16601668            if (value instanceof String) {
    16611669                return DateFormat.getDateInstance(3, Locale.US).parse((String) value);
Note: See TracChangeset for help on using the changeset viewer.