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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.