Changeset 19541 in josm


Ignore:
Timestamp:
2026-02-24T14:22:52+01:00 (22 hours ago)
Author:
stoecker
Message:

remove outdated expiry data check, see #24635

Location:
trunk/src/org/openstreetmap/josm/tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/PlatformHook.java

    r19139 r19541  
    1717import java.security.cert.CertificateException;
    1818import java.security.cert.X509Certificate;
    19 import java.text.DateFormat;
    2019import java.util.ArrayList;
    2120import java.util.Collection;
    2221import java.util.Collections;
    23 import java.util.Date;
    2422import java.util.List;
    2523
     
    2725import org.openstreetmap.josm.io.CertificateAmendment.NativeCertAmend;
    2826import org.openstreetmap.josm.spi.preferences.Config;
    29 import org.openstreetmap.josm.tools.date.DateUtils;
    3027
    3128/**
     
    292289         */
    293290        void sanityCheckFailed(String title, boolean canContinue, String... message);
    294     }
    295 
    296     /**
    297      * Checks if the running version of Java has expired, proposes to user to update it if needed.
    298      * @param callback Java expiration callback
    299      * @since 12270 (signature)
    300      * @since 12219
    301      */
    302     default void checkExpiredJava(JavaExpirationCallback callback) {
    303         Date expiration = Utils.getJavaExpirationDate();
    304         if (expiration != null && expiration.before(new Date())) {
    305             String latestVersion = Utils.getJavaLatestVersion();
    306             String currentVersion = Utils.getSystemProperty("java.version");
    307             // #17831 WebStart may be launched with an expired JRE but then launching JOSM with up-to-date JRE
    308             if (latestVersion == null || !latestVersion.equalsIgnoreCase(currentVersion)) {
    309                 callback.askUpdateJava(latestVersion != null ? latestVersion : "latest",
    310                         Config.getPref().get("java.update.url", getJavaUrl()),
    311                         DateUtils.getDateFormat(DateFormat.MEDIUM).format(expiration), false);
    312             }
    313         }
    314291    }
    315292
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java

    r19205 r19541  
    9191        }
    9292        warnSoonToBeUnsupportedJava(javaCallback);
    93         checkExpiredJava(javaCallback);
    9493        PlatformHook.super.startupHook(javaCallback, sanityCheckCallback);
    9594    }
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java

    r19534 r19541  
    157157    public void startupHook(JavaExpirationCallback javaCallback, SanityCheckCallback sanityCheckCallback) {
    158158        warnSoonToBeUnsupportedJava(javaCallback);
    159         checkExpiredJava(javaCallback);
    160159        PlatformHook.super.startupHook(javaCallback, sanityCheckCallback);
    161160    }
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r19437 r19541  
    3232import java.security.NoSuchAlgorithmException;
    3333import java.text.Bidi;
    34 import java.text.DateFormat;
    3534import java.text.MessageFormat;
    3635import java.text.Normalizer;
    37 import java.text.ParseException;
    3836import java.util.AbstractCollection;
    3937import java.util.AbstractList;
     
    4240import java.util.Collection;
    4341import java.util.Collections;
    44 import java.util.Date;
    4542import java.util.Iterator;
    4643import java.util.List;
     
    17061703
    17071704    /**
    1708      * Returns the JRE expiration date.
    1709      * @return the JRE expiration date, or null
    1710      * @since 12219
    1711      */
    1712     public static Date getJavaExpirationDate() {
    1713         try {
    1714             Object value;
    1715             Class<?> c = Class.forName("com.sun.deploy.config.BuiltInProperties");
    1716             try {
    1717                 value = c.getDeclaredField("JRE_EXPIRATION_DATE").get(null);
    1718             } catch (NoSuchFieldException e) {
    1719                 // Field is gone with Java 9, there's a method instead
    1720                 Logging.trace(e);
    1721                 value = c.getDeclaredMethod("getProperty", String.class).invoke(null, "JRE_EXPIRATION_DATE");
    1722             }
    1723             if (value instanceof String) {
    1724                 return DateFormat.getDateInstance(3, Locale.US).parse((String) value);
    1725             }
    1726         } catch (IllegalArgumentException | ReflectiveOperationException | SecurityException | ParseException e) {
    1727             Logging.debug(e);
    1728         }
    1729         return null;
    1730     }
    1731 
    1732     /**
    17331705     * Returns the latest version of Java, from Oracle website.
    17341706     * @return the latest version of Java, from Oracle website
Note: See TracChangeset for help on using the changeset viewer.