Changeset 12219 in josm for trunk/src/org/openstreetmap/josm/tools/Utils.java
- Timestamp:
- 2017-05-20T19:06:29+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Utils.java
r12217 r12219 32 32 import java.security.PrivilegedAction; 33 33 import java.text.Bidi; 34 import java.text.DateFormat; 34 35 import java.text.MessageFormat; 36 import java.text.ParseException; 35 37 import java.util.AbstractCollection; 36 38 import java.util.AbstractList; … … 39 41 import java.util.Collection; 40 42 import java.util.Collections; 43 import java.util.Date; 41 44 import java.util.Iterator; 42 45 import java.util.List; … … 1646 1649 return Integer.parseInt(version.substring(bPos > -1 ? bPos + 1 : pPos + 1, version.length())); 1647 1650 } 1651 1652 /** 1653 * Returns the JRE expiration date. 1654 * @return the JRE expiration date, or null 1655 * @since 12219 1656 */ 1657 public static Date getJavaExpirationDate() { 1658 try { 1659 Object value = Class.forName("com.sun.deploy.config.BuiltInProperties").getDeclaredField("JRE_EXPIRATION_DATE").get(null); 1660 if (value instanceof String) { 1661 return DateFormat.getDateInstance(3, Locale.US).parse((String) value); 1662 } 1663 } catch (IllegalArgumentException | ReflectiveOperationException | SecurityException | ParseException e) { 1664 Main.debug(e); 1665 } 1666 return null; 1667 } 1668 1669 /** 1670 * Returns the latest version of Java, from Oracle website. 1671 * @return the latest version of Java, from Oracle website 1672 * @since 12219 1673 */ 1674 public static String getJavaLatestVersion() { 1675 try { 1676 return HttpClient.create( 1677 new URL(Main.pref.get("java.baseline.version.url", "http://javadl-esd-secure.oracle.com/update/baseline.version"))) 1678 .connect().fetchContent().split("\n")[0]; 1679 } catch (IOException e) { 1680 Main.error(e); 1681 } 1682 return null; 1683 } 1648 1684 }
Note:
See TracChangeset
for help on using the changeset viewer.