Changeset 12130 in josm for trunk/src/org/openstreetmap/josm
- Timestamp:
- 2017-05-13T00:56:58+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Preferences.java
r12095 r12130 1405 1405 /** 1406 1406 * Updates system properties with the current values in the preferences. 1407 *1408 1407 */ 1409 1408 public void updateSystemProperties() { … … 1417 1416 // Force AWT toolkit to update its internal preferences (fix #6345). 1418 1417 // Does not work anymore with Java 9, to remove with Java 9 migration 1419 if ( !GraphicsEnvironment.isHeadless()) {1418 if (Utils.getJavaVersion() < 9 && !GraphicsEnvironment.isHeadless()) { 1420 1419 try { 1421 1420 Field field = Toolkit.class.getDeclaredField("resources"); -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r12015 r12130 1586 1586 return angleDeg * TO_RADIANS; 1587 1587 } 1588 1589 /** 1590 * Returns the Java version as an int value. 1591 * @return the Java version as an int value (8, 9, etc.) 1592 * @since 12130 1593 */ 1594 public static int getJavaVersion() { 1595 String version = System.getProperty("java.version"); 1596 if (version.startsWith("1.")) { 1597 version = version.substring(2); 1598 } 1599 // Allow these formats: 1600 // 1.8.0_72-ea 1601 // 9-ea 1602 // 9 1603 // 9.0.1 1604 int dotPos = version.indexOf('.'); 1605 int dashPos = version.indexOf('-'); 1606 return Integer.parseInt(version.substring(0, 1607 dotPos > -1 ? dotPos : dashPos > -1 ? dashPos : 1)); 1608 } 1588 1609 }
Note:
See TracChangeset
for help on using the changeset viewer.