Changeset 7894 in josm
- Timestamp:
- 2014-12-27T00:08:31+01:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r7817 r7894 695 695 /** 696 696 * Add a new layer to the map. 697 * 697 * 698 698 * If no map exists, create one. 699 * 699 * 700 700 * @param layer the layer 701 * 701 * 702 702 * @see #addLayer(Layer, ProjectionBounds) 703 703 * @see #addLayer(Layer, ViewportData) … … 711 711 /** 712 712 * Add a new layer to the map. 713 * 713 * 714 714 * If no map exists, create one. 715 * 715 * 716 716 * @param layer the layer 717 717 * @param bounds the bounds of the layer (target zoom area); can be null, then … … 724 724 /** 725 725 * Add a new layer to the map. 726 * 726 * 727 727 * If no map exists, create one. 728 * 728 * 729 729 * @param layer the layer 730 730 * @param viewport the viewport to zoom to; can be null, then the viewport … … 1236 1236 1237 1237 /** 1238 * Determines if JOSM currently runs with Java 8 or later. 1239 * @return {@code true} if the current JVM is at least Java 8, {@code false} otherwise 1240 * @since 7894 1241 */ 1242 public static boolean isJava8orLater() { 1243 String version = System.getProperty("java.version"); 1244 return version != null && !version.matches("^(1\\.)?[7].*"); 1245 } 1246 1247 /** 1238 1248 * Checks that JOSM is at least running with Java 7. 1239 1249 * @since 7001 -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r7841 r7894 94 94 */ 95 95 private File cacheDir = null; 96 96 97 97 /** 98 98 * Internal storage for the user data directory. … … 1375 1375 if(getBoolean("prefer.ipv6", false)) { 1376 1376 // never set this to false, only true! 1377 updateSystemProperty("java.net.preferIPv6Addresses", "true");1378 } 1379 updateSystemProperty("http.agent", Version.getInstance().getAgentString());1380 updateSystemProperty("user.language", get("language"));1377 Utils.updateSystemProperty("java.net.preferIPv6Addresses", "true"); 1378 } 1379 Utils.updateSystemProperty("http.agent", Version.getInstance().getAgentString()); 1380 Utils.updateSystemProperty("user.language", get("language")); 1381 1381 // Workaround to fix a Java bug. 1382 1382 // Force AWT toolkit to update its internal preferences (fix #3645). … … 1392 1392 // See http://stackoverflow.com/q/7615645/2257172 and #9875 1393 1393 if (getBoolean("jdk.tls.disableSNIExtension", true)) { 1394 updateSystemProperty("jsse.enableSNIExtension", "false");1394 Utils.updateSystemProperty("jsse.enableSNIExtension", "false"); 1395 1395 } 1396 1396 // Workaround to fix another Java bug … … 1399 1399 // and https://bugs.openjdk.java.net/browse/JDK-6923200 1400 1400 if (getBoolean("jdk.Arrays.useLegacyMergeSort", !Version.getInstance().isLocalBuild())) { 1401 updateSystemProperty("java.util.Arrays.useLegacyMergeSort", "true"); 1402 } 1403 } 1404 1405 /** 1406 * Updates a given system property. 1407 * @param key The property key 1408 * @param value The property value 1409 * @return the previous value of the system property, or {@code null} if it did not have one. 1410 * @since 6851 1411 */ 1412 public static String updateSystemProperty(String key, String value) { 1413 if (value != null) { 1414 String old = System.setProperty(key, value); 1415 if (!key.toLowerCase().contains("password")) { 1416 Main.debug("System property '"+key+"' set to '"+value+"'. Old value was '"+old+"'"); 1417 } else { 1418 Main.debug("System property '"+key+"' changed."); 1419 } 1420 return old; 1421 } 1422 return null; 1401 Utils.updateSystemProperty("java.util.Arrays.useLegacyMergeSort", "true"); 1402 } 1423 1403 } 1424 1404 -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r7864 r7894 46 46 import org.openstreetmap.josm.data.AutosaveTask; 47 47 import org.openstreetmap.josm.data.CustomConfigurator; 48 import org.openstreetmap.josm.data.Preferences;49 48 import org.openstreetmap.josm.data.Version; 50 49 import org.openstreetmap.josm.gui.download.DownloadDialog; … … 348 347 logLevel = 5; 349 348 // Enable debug in OAuth signpost via system preference, but only at trace level 350 Preferences.updateSystemProperty("debug", "true");349 Utils.updateSystemProperty("debug", "true"); 351 350 Main.info(tr("Enabled detailed debug level (trace)")); 352 351 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpsServer.java
r7800 r7894 146 146 // https://bugs.openjdk.java.net/browse/JDK-8040820 147 147 // https://bugs.openjdk.java.net/browse/JDK-7198416 148 String version = System.getProperty("java.version"); 149 if (version == null || version.matches("^(1\\.)?[7].*")) { 148 if (!Main.isJava8orLater()) { 150 149 // Java 7 code. To remove with Java 8 migration 151 150 info.set(X509CertInfo.SUBJECT, new CertificateSubjectName(owner)); -
trunk/src/org/openstreetmap/josm/tools/I18n.java
r7893 r7894 39 39 } 40 40 41 /** 42 * Enumeration of possible plural modes. 43 * See <a href="http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html">CLDR</a> 44 * for a complete list. 45 * @see #pluralEval 46 */ 41 47 private enum PluralMode { 42 MODE_NOTONE, MODE_NONE, MODE_GREATERONE, 43 MODE_CS/*, MODE_AR*/, MODE_PL/*, MODE_RO*/, MODE_RU, MODE_SK/*, MODE_SL*/} 48 /** Plural = Not 1. This is the default for many languages, including English: 1 day, but 0 days or 2 days. */ 49 MODE_NOTONE, 50 /** No plural. Mainly for Asian languages (Indonesian, Chinese, Japanese, ...) */ 51 MODE_NONE, 52 /** Plural = Greater than 1. For some latin languages (French, Brazilian Portuguese) */ 53 MODE_GREATERONE, 54 /* Special mode for 55 * <a href="http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html#ar">Arabic</a>.* 56 MODE_AR,*/ 57 /** Special mode for 58 * <a href="http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html#cs">Czech</a>. */ 59 MODE_CS, 60 /** Special mode for 61 * <a href="http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html#pl">Polish</a>. */ 62 MODE_PL, 63 /* Special mode for 64 * <a href="http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html#ro">Romanian</a>.* 65 MODE_RO,*/ 66 /** Special mode for 67 * <a href="http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html#ru">Russian</a>. */ 68 MODE_RU, 69 /** Special mode for 70 * <a href="http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html#sk">Slovak</a>. */ 71 MODE_SK, 72 /* Special mode for 73 * <a href="http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html#sl">Slovenian</a>.* 74 MODE_SL,*/ 75 } 76 44 77 private static PluralMode pluralMode = PluralMode.MODE_NOTONE; /* english default */ 45 78 private static String loadedCode = "en"; … … 353 386 */ 354 387 public static void init() { 388 // Enable CLDR locale provider on Java 8 to get additional languages, such as Khmer. 389 // http://docs.oracle.com/javase/8/docs/technotes/guides/intl/enhancements.8.html#cldr 390 // This can be removed after we switch to a minimal version of Java that enables CLDR by default 391 // or includes all languages we need in the JRE. See http://openjdk.java.net/jeps/8043554 for Java 9 392 Utils.updateSystemProperty("java.locale.providers", "JRE,CLDR"); 393 355 394 //languages.put("ar", PluralMode.MODE_AR); 356 395 languages.put("bg", PluralMode.MODE_NOTONE); … … 374 413 languages.put("it", PluralMode.MODE_NOTONE); 375 414 languages.put("ja", PluralMode.MODE_NONE); 415 if (Main.isJava8orLater()) { 416 // Java 8 and later code 417 languages.put("km", PluralMode.MODE_NONE); 418 } 376 419 //languages.put("nb", PluralMode.MODE_NOTONE); 377 420 languages.put("nl", PluralMode.MODE_NOTONE); … … 649 692 case MODE_NOTONE: /* bg, da, de, el, en, en_GB, es, et, eu, fi, gl, is, it, iw_IL, nb, nl, sv */ 650 693 return ((n != 1) ? 1 : 0); 651 case MODE_NONE: /* ja, tr, zh_CN, zh_TW */694 case MODE_NONE: /* id, ja, km, tr, zh_CN, zh_TW */ 652 695 return 0; 653 696 case MODE_GREATERONE: /* fr, pt_BR */ -
trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java
r7846 r7894 19 19 import org.openstreetmap.josm.Main; 20 20 import org.openstreetmap.josm.actions.OpenFileAction.OpenFileTask; 21 import org.openstreetmap.josm.data.Preferences;22 21 import org.openstreetmap.josm.io.OsmTransferException; 23 22 import org.xml.sax.SAXException; … … 37 36 // And will not work when one of the system independent LAFs is used. 38 37 // They just insist on painting themselves... 39 Preferences.updateSystemProperty("apple.laf.useScreenMenuBar", "true");38 Utils.updateSystemProperty("apple.laf.useScreenMenuBar", "true"); 40 39 migrateOldDirectory(); 41 40 } -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r7869 r7894 1144 1144 return new Pair<>(noThreads, pool); 1145 1145 } 1146 1147 /** 1148 * Updates a given system property. 1149 * @param key The property key 1150 * @param value The property value 1151 * @return the previous value of the system property, or {@code null} if it did not have one. 1152 * @since 7894 1153 */ 1154 public static String updateSystemProperty(String key, String value) { 1155 if (value != null) { 1156 String old = System.setProperty(key, value); 1157 if (!key.toLowerCase().contains("password")) { 1158 Main.debug("System property '"+key+"' set to '"+value+"'. Old value was '"+old+"'"); 1159 } else { 1160 Main.debug("System property '"+key+"' changed."); 1161 } 1162 return old; 1163 } 1164 return null; 1165 } 1146 1166 }
Note:
See TracChangeset
for help on using the changeset viewer.