Changeset 8404 in josm for trunk/src/org
- Timestamp:
- 2015-05-21T01:18:35+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 57 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r8395 r8404 28 28 import java.util.Iterator; 29 29 import java.util.List; 30 import java.util.Locale; 30 31 import java.util.Map; 31 32 import java.util.Objects; … … 542 543 public Main() { 543 544 main = this; 544 isOpenjdk = System.getProperty("java.vm.name").toUpperCase( ).indexOf("OPENJDK") != -1;545 isOpenjdk = System.getProperty("java.vm.name").toUpperCase(Locale.ENGLISH).indexOf("OPENJDK") != -1; 545 546 546 547 if (initListener != null) { … … 1188 1189 warn("Your operating system has no name, so I'm guessing its some kind of *nix."); 1189 1190 platform = new PlatformHookUnixoid(); 1190 } else if (os.toLowerCase( ).startsWith("windows")) {1191 } else if (os.toLowerCase(Locale.ENGLISH).startsWith("windows")) { 1191 1192 platform = new PlatformHookWindows(); 1192 1193 } else if ("Linux".equals(os) || "Solaris".equals(os) || … … 1194 1195 "FreeBSD".equals(os) || "NetBSD".equals(os) || "OpenBSD".equals(os)) { 1195 1196 platform = new PlatformHookUnixoid(); 1196 } else if (os.toLowerCase( ).startsWith("mac os x")) {1197 } else if (os.toLowerCase(Locale.ENGLISH).startsWith("mac os x")) { 1197 1198 platform = new PlatformHookOsx(); 1198 1199 } else { -
trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java
r8338 r8404 18 18 import org.openstreetmap.josm.io.FileExporter; 19 19 import org.openstreetmap.josm.io.FileImporter; 20 import org.openstreetmap.josm.tools.Utils; 20 21 21 22 /** … … 282 283 */ 283 284 public boolean acceptName(String filename) { 284 String name = filename.toLowerCase(); 285 for (String ext : extensions.split(",")) 286 if (name.endsWith("."+ext)) 287 return true; 288 return false; 285 return Utils.hasExtension(filename, extensions.split(",")); 289 286 } 290 287 -
trunk/src/org/openstreetmap/josm/actions/SessionLoadAction.java
r7578 r8404 53 53 if (fc == null) return; 54 54 File file = fc.getSelectedFile(); 55 boolean zip = file.getName().toLowerCase().endsWith(".joz");55 boolean zip = Utils.hasExtension(file, "joz"); 56 56 Main.worker.submit(new Loader(file, zip)); 57 57 } -
trunk/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java
r8308 r8404 41 41 import org.openstreetmap.josm.tools.GBC; 42 42 import org.openstreetmap.josm.tools.MultiMap; 43 import org.openstreetmap.josm.tools.Utils; 43 44 import org.openstreetmap.josm.tools.WindowGeometry; 44 45 … … 106 107 zip = false; 107 108 } else { 108 if ( fn.toLowerCase().endsWith(".joz")) {109 if (Utils.hasExtension(fn, "joz")) { 109 110 zip = true; 110 111 } else { -
trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
r8394 r8404 15 15 import java.util.List; 16 16 import java.util.ListIterator; 17 import java.util.Locale; 17 18 import java.util.Map; 18 19 import java.util.Map.Entry; … … 111 112 String[] param = value.split("="); 112 113 // Hide some parameters for privacy concerns 113 if (param[0].toLowerCase( ).startsWith("-dproxy")) {114 if (param[0].toLowerCase(Locale.ENGLISH).startsWith("-dproxy")) { 114 115 it.set(param[0]+"=xxx"); 115 116 // Shorten some parameters for readability concerns -
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r8394 r8404 11 11 import java.util.Collection; 12 12 import java.util.HashMap; 13 import java.util.Locale; 13 14 import java.util.Map; 14 15 import java.util.regex.Matcher; … … 477 478 this.valuePattern = null; 478 479 } else { 479 this.key = key.toLowerCase( );480 this.key = key.toLowerCase(Locale.ENGLISH); 480 481 this.value = value; 481 482 this.keyPattern = null; … … 523 524 return false; 524 525 525 String v1 = caseSensitive ? mv : mv.toLowerCase( );526 String v2 = caseSensitive ? value : value.toLowerCase( );526 String v1 = caseSensitive ? mv : mv.toLowerCase(Locale.ENGLISH); 527 String v2 = caseSensitive ? value : value.toLowerCase(Locale.ENGLISH); 527 528 528 529 v1 = Normalizer.normalize(v1, Normalizer.Form.NFC); … … 533 534 return false; 534 535 } 535 @Override public String toString() {return key+"="+value;} 536 @Override 537 public String toString() { 538 return key + "=" + value; 539 } 536 540 } 537 541 … … 719 723 this.searchRegex = null; 720 724 } else { 721 this.search = s.toLowerCase( );725 this.search = s.toLowerCase(Locale.ENGLISH); 722 726 this.searchRegex = null; 723 727 } … … 744 748 } else { 745 749 if (!caseSensitive) { 746 key = key.toLowerCase( );747 value = value.toLowerCase( );750 key = key.toLowerCase(Locale.ENGLISH); 751 value = value.toLowerCase(Locale.ENGLISH); 748 752 } 749 753 -
trunk/src/org/openstreetmap/josm/corrector/ReverseWayTagCorrector.java
r8379 r8404 8 8 import java.util.HashMap; 9 9 import java.util.List; 10 import java.util.Locale; 10 11 import java.util.Map; 11 12 import java.util.regex.Matcher; … … 75 76 76 77 if (m.lookingAt()) { 77 String leftRight = m.group(2).toLowerCase( );78 String leftRight = m.group(2).toLowerCase(Locale.ENGLISH); 78 79 79 80 StringBuilder result = new StringBuilder(); -
trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java
r8395 r8404 19 19 import java.util.Iterator; 20 20 import java.util.List; 21 import java.util.Locale; 21 22 import java.util.Map; 22 23 import java.util.Map.Entry; … … 281 282 } 282 283 283 284 284 public static void deleteFile(String path, String base) { 285 285 String dir = getDirectoryByAbbr(base); … … 320 320 private static boolean busy=false; 321 321 322 323 322 public static void pluginOperation(String install, String uninstall, String delete) { 324 323 final List<String> installList = new ArrayList<>(); 325 324 final List<String> removeList = new ArrayList<>(); 326 325 final List<String> deleteList = new ArrayList<>(); 327 Collections.addAll(installList, install.toLowerCase().split(";")); 328 Collections.addAll(removeList, uninstall.toLowerCase().split(";")); 329 Collections.addAll(deleteList, delete.toLowerCase().split(";")); 330 installList.remove("");removeList.remove("");deleteList.remove(""); 326 Collections.addAll(installList, install.toLowerCase(Locale.ENGLISH).split(";")); 327 Collections.addAll(removeList, uninstall.toLowerCase(Locale.ENGLISH).split(";")); 328 Collections.addAll(deleteList, delete.toLowerCase(Locale.ENGLISH).split(";")); 329 installList.remove(""); 330 removeList.remove(""); 331 deleteList.remove(""); 331 332 332 333 if (!installList.isEmpty()) { … … 346 347 if (task.isCanceled()) return; 347 348 synchronized (CustomConfigurator.class) { 348 try { // proceed only after all other tasks were finished 349 while (busy) CustomConfigurator.class.wait(); 350 } catch (InterruptedException ex) { 351 Main.warn("InterruptedException while reading local plugin information"); 352 } 353 354 SwingUtilities.invokeLater(new Runnable() { 355 @Override 356 public void run() { 357 List<PluginInformation> availablePlugins = task.getAvailablePlugins(); 358 List<PluginInformation> toInstallPlugins = new ArrayList<>(); 359 List<PluginInformation> toRemovePlugins = new ArrayList<>(); 360 List<PluginInformation> toDeletePlugins = new ArrayList<>(); 361 for (PluginInformation pi: availablePlugins) { 362 String name = pi.name.toLowerCase(); 363 if (installList.contains(name)) toInstallPlugins.add(pi); 364 if (removeList.contains(name)) toRemovePlugins.add(pi); 365 if (deleteList.contains(name)) toDeletePlugins.add(pi); 349 try { // proceed only after all other tasks were finished 350 while (busy) CustomConfigurator.class.wait(); 351 } catch (InterruptedException ex) { 352 Main.warn("InterruptedException while reading local plugin information"); 353 } 354 355 SwingUtilities.invokeLater(new Runnable() { 356 @Override 357 public void run() { 358 List<PluginInformation> availablePlugins = task.getAvailablePlugins(); 359 List<PluginInformation> toInstallPlugins = new ArrayList<>(); 360 List<PluginInformation> toRemovePlugins = new ArrayList<>(); 361 List<PluginInformation> toDeletePlugins = new ArrayList<>(); 362 for (PluginInformation pi: availablePlugins) { 363 String name = pi.name.toLowerCase(Locale.ENGLISH); 364 if (installList.contains(name)) toInstallPlugins.add(pi); 365 if (removeList.contains(name)) toRemovePlugins.add(pi); 366 if (deleteList.contains(name)) toDeletePlugins.add(pi); 367 } 368 if (!installList.isEmpty()) { 369 PluginDownloadTask pluginDownloadTask = 370 new PluginDownloadTask(Main.parent, toInstallPlugins, tr("Installing plugins")); 371 Main.worker.submit(pluginDownloadTask); 372 } 373 Collection<String> pls = new ArrayList<>(Main.pref.getCollection("plugins")); 374 for (PluginInformation pi: toInstallPlugins) { 375 if (!pls.contains(pi.name)) { 376 pls.add(pi.name); 377 } 378 } 379 for (PluginInformation pi: toRemovePlugins) { 380 pls.remove(pi.name); 381 } 382 for (PluginInformation pi: toDeletePlugins) { 383 pls.remove(pi.name); 384 new File(Main.pref.getPluginsDirectory(), pi.name+".jar").deleteOnExit(); 385 } 386 Main.pref.putCollection("plugins",pls); 366 387 } 367 if (!installList.isEmpty()) { 368 PluginDownloadTask pluginDownloadTask = new PluginDownloadTask(Main.parent, toInstallPlugins, tr ("Installing plugins")); 369 Main.worker.submit(pluginDownloadTask); 370 } 371 Collection<String> pls = new ArrayList<>(Main.pref.getCollection("plugins")); 372 for (PluginInformation pi: toInstallPlugins) { 373 if (!pls.contains(pi.name)) { 374 pls.add(pi.name); 375 } 376 } 377 for (PluginInformation pi: toRemovePlugins) { 378 pls.remove(pi.name); 379 } 380 for (PluginInformation pi: toDeletePlugins) { 381 pls.remove(pi.name); 382 new File(Main.pref.getPluginsDirectory(), pi.name+".jar").deleteOnExit(); 383 } 384 Main.pref.putCollection("plugins",pls); 385 } 386 }); 387 } 388 } 389 388 }); 389 } 390 } 390 391 }; 391 392 Main.worker.submit(task); -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r8393 r8404 10 10 import java.util.Collections; 11 11 import java.util.List; 12 import java.util.Locale; 12 13 import java.util.Map; 13 14 import java.util.Objects; … … 545 546 int i = countryCode.compareTo(in.countryCode); 546 547 if (i == 0) { 547 i = name.toLowerCase( ).compareTo(in.name.toLowerCase());548 i = name.toLowerCase(Locale.ENGLISH).compareTo(in.name.toLowerCase(Locale.ENGLISH)); 548 549 } 549 550 if (i == 0) { … … 690 691 try { 691 692 serverProjections = new ArrayList<>(); 692 Matcher m = Pattern.compile(".*\\{PROJ\\(([^)}]+)\\)\\}.*").matcher(url.toUpperCase( ));693 Matcher m = Pattern.compile(".*\\{PROJ\\(([^)}]+)\\)\\}.*").matcher(url.toUpperCase(Locale.ENGLISH)); 693 694 if(m.matches()) { 694 695 for(String p : m.group(1).split(",")) -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r8395 r8404 15 15 import java.util.LinkedList; 16 16 import java.util.List; 17 import java.util.Locale; 17 18 import java.util.Map; 18 19 import java.util.Set; … … 1342 1343 public Object getTemplateValue(String name, boolean special) { 1343 1344 if (special) { 1344 String lc = name.toLowerCase( );1345 String lc = name.toLowerCase(Locale.ENGLISH); 1345 1346 if (SPECIAL_VALUE_ID.equals(lc)) 1346 1347 return getId(); -
trunk/src/org/openstreetmap/josm/data/preferences/ColorProperty.java
r7937 r8404 3 3 4 4 import java.awt.Color; 5 import java.util.Locale; 5 6 6 7 import org.openstreetmap.josm.Main; … … 14 15 15 16 private final String name; 16 17 17 18 /** 18 19 * Constructs a new {@code ColorProperty}. … … 24 25 this.name = colName; 25 26 } 26 27 27 28 @Override 28 29 public Color get() { … … 34 35 return Main.pref.putColor(getColorKey(name), value); 35 36 } 36 37 37 38 /** 38 39 * Replies the color key used in JOSM preferences for this property. … … 41 42 */ 42 43 public static String getColorKey(String colName) { 43 return colName == null ? null : colName.toLowerCase( ).replaceAll("[^a-z0-9]+",".");44 return colName == null ? null : colName.toLowerCase(Locale.ENGLISH).replaceAll("[^a-z0-9]+","."); 44 45 } 45 46 -
trunk/src/org/openstreetmap/josm/data/projection/Projections.java
r8255 r8404 11 11 import java.util.HashMap; 12 12 import java.util.HashSet; 13 import java.util.Locale; 13 14 import java.util.Map; 14 15 import java.util.Set; … … 133 134 */ 134 135 public static String getInit(String id) { 135 Pair<String, String> r = inits.get(id.toUpperCase( ));136 Pair<String, String> r = inits.get(id.toUpperCase(Locale.ENGLISH)); 136 137 if (r == null) return null; 137 138 return r.b; -
trunk/src/org/openstreetmap/josm/data/validation/routines/DomainValidator.java
r8345 r8404 18 18 19 19 import java.util.Arrays; 20 import java.util.Locale; 20 21 21 22 /** … … 170 171 */ 171 172 public boolean isValidInfrastructureTld(String iTld) { 172 return Arrays.binarySearch(INFRASTRUCTURE_TLDS, chompLeadingDot(iTld.toLowerCase( ))) >= 0;173 return Arrays.binarySearch(INFRASTRUCTURE_TLDS, chompLeadingDot(iTld.toLowerCase(Locale.ENGLISH))) >= 0; 173 174 } 174 175 … … 181 182 */ 182 183 public boolean isValidGenericTld(String gTld) { 183 return Arrays.binarySearch(GENERIC_TLDS, chompLeadingDot(gTld.toLowerCase( ))) >= 0;184 return Arrays.binarySearch(GENERIC_TLDS, chompLeadingDot(gTld.toLowerCase(Locale.ENGLISH))) >= 0; 184 185 } 185 186 … … 192 193 */ 193 194 public boolean isValidIdnTld(String iTld) { 194 return Arrays.binarySearch(IDN_TLDS, chompLeadingDot(iTld.toUpperCase( ))) >= 0;195 return Arrays.binarySearch(IDN_TLDS, chompLeadingDot(iTld.toUpperCase(Locale.ENGLISH))) >= 0; 195 196 } 196 197 … … 203 204 */ 204 205 public boolean isValidCountryCodeTld(String ccTld) { 205 return Arrays.binarySearch(COUNTRY_CODE_TLDS, chompLeadingDot(ccTld.toLowerCase( ))) >= 0;206 return Arrays.binarySearch(COUNTRY_CODE_TLDS, chompLeadingDot(ccTld.toLowerCase(Locale.ENGLISH))) >= 0; 206 207 } 207 208 … … 214 215 */ 215 216 public boolean isValidLocalTld(String iTld) { 216 return Arrays.binarySearch(LOCAL_TLDS, chompLeadingDot(iTld.toLowerCase( ))) >= 0;217 return Arrays.binarySearch(LOCAL_TLDS, chompLeadingDot(iTld.toLowerCase(Locale.ENGLISH))) >= 0; 217 218 } 218 219 -
trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java
r7986 r8404 12 12 import java.util.Iterator; 13 13 import java.util.List; 14 import java.util.Locale; 14 15 import java.util.Map; 15 16 import java.util.Map.Entry; … … 151 152 String number = p.get(ADDR_HOUSE_NUMBER); 152 153 if (number != null) { 153 number = number.trim().toUpperCase( );154 number = number.trim().toUpperCase(Locale.ENGLISH); 154 155 List<OsmPrimitive> list = map.get(number); 155 156 if (list == null) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r8390 r8404 21 21 import java.util.LinkedList; 22 22 import java.util.List; 23 import java.util.Locale; 23 24 import java.util.Map; 24 25 import java.util.Set; … … 253 254 sb.append("throw") 254 255 .append(s.name().charAt(0)) 255 .append(s.name().substring(1).toLowerCase( ));256 .append(s.name().substring(1).toLowerCase(Locale.ENGLISH)); 256 257 } 257 258 return sb.toString(); … … 276 277 if (ai.key.startsWith("throw")) { 277 278 try { 278 final Severity severity = Severity.valueOf(ai.key.substring("throw".length()).toUpperCase( ));279 final Severity severity = Severity.valueOf(ai.key.substring("throw".length()).toUpperCase(Locale.ENGLISH)); 279 280 check.errors.put(ai, severity); 280 281 } catch (IllegalArgumentException e) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/SimilarNamedWays.java
r8390 r8404 11 11 import java.util.HashMap; 12 12 import java.util.List; 13 import java.util.Locale; 13 14 import java.util.Map; 14 15 import java.util.regex.Matcher; … … 250 251 251 252 public SynonymRule(String replacement, String[] words) { 252 this.replacement = replacement.toLowerCase( );253 this.replacement = replacement.toLowerCase(Locale.ENGLISH); 253 254 this.words = words; 254 255 -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r8394 r8404 18 18 import java.util.HashMap; 19 19 import java.util.List; 20 import java.util.Locale; 20 21 import java.util.Map; 21 22 import java.util.Map.Entry; … … 424 425 } 425 426 if (checkFixmes && key != null && value != null && value.length() > 0) { 426 if ((value.toLowerCase( ).contains("fixme")427 if ((value.toLowerCase(Locale.ENGLISH).contains("fixme") 427 428 || value.contains("check and delete") 428 || key.contains("todo") || key.toLowerCase( ).contains("fixme"))429 || key.contains("todo") || key.toLowerCase(Locale.ENGLISH).contains("fixme")) 429 430 && !withErrors.contains(p, "FIXME")) { 430 431 errors.add(new TestError(this, Severity.OTHER, -
trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java
r8399 r8404 15 15 import java.util.Iterator; 16 16 import java.util.List; 17 import java.util.Locale; 17 18 18 19 import javax.swing.Action; … … 54 55 @Override 55 56 public int compare(ImageryInfo ii1, ImageryInfo ii2) { 56 return ii1.getName().toLowerCase( ).compareTo(ii2.getName().toLowerCase());57 return ii1.getName().toLowerCase(Locale.ENGLISH).compareTo(ii2.getName().toLowerCase(Locale.ENGLISH)); 57 58 } 58 59 }; -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r8392 r8404 34 34 import java.util.LinkedList; 35 35 import java.util.List; 36 import java.util.Locale; 36 37 import java.util.Map; 37 38 import java.util.Set; … … 206 207 207 208 private Option(boolean requiresArgument) { 208 this.name = name().toLowerCase( ).replace("_", "-");209 this.name = name().toLowerCase(Locale.ENGLISH).replace("_", "-"); 209 210 this.requiresArg = requiresArgument; 210 211 } … … 229 230 Map<Option, Collection<String>> res = new EnumMap<>(Option.class); 230 231 for (Map.Entry<String, Collection<String>> e : opts.entrySet()) { 231 Option o = Option.valueOf(e.getKey().toUpperCase( ).replace("-", "_"));232 Option o = Option.valueOf(e.getKey().toUpperCase(Locale.ENGLISH).replace("-", "_")); 232 233 if (o != null) { 233 234 res.put(o, e.getValue()); … … 509 510 for (String s : args.get(Option.OFFLINE).iterator().next().split(",")) { 510 511 try { 511 Main.setOffline(OnlineResource.valueOf(s.toUpperCase( )));512 Main.setOffline(OnlineResource.valueOf(s.toUpperCase(Locale.ENGLISH))); 512 513 } catch (IllegalArgumentException e) { 513 514 Main.error(tr("''{0}'' is not a valid value for argument ''{1}''. Possible values are {2}, possibly delimited by commas.", 514 s.toUpperCase( ), Option.OFFLINE.getName(), Arrays.toString(OnlineResource.values())));515 s.toUpperCase(Locale.ENGLISH), Option.OFFLINE.getName(), Arrays.toString(OnlineResource.values()))); 515 516 System.exit(1); 516 517 return; -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r8399 r8404 16 16 import java.util.HashMap; 17 17 import java.util.List; 18 import java.util.Locale; 18 19 import java.util.Map; 19 20 … … 857 858 */ 858 859 private List<JMenuItem> findMenuItems(String textToFind) { 859 textToFind = textToFind.toLowerCase(); 860 // Explicitely use default locale in this case, because we're looking for translated strings 861 textToFind = textToFind.toLowerCase(Locale.getDefault()); 860 862 List<JMenuItem> result = new ArrayList<>(); 861 863 862 864 // Iterate over main menus 863 865 for (MenuElement menuElement : getSubElements()) { 864 if (!(menuElement instanceof JMenu)) continue;866 if (!(menuElement instanceof JMenu)) continue; 865 867 866 868 JMenu mainMenuItem = (JMenu) menuElement; 867 if (mainMenuItem.getAction()!=null && mainMenuItem.getText().toLowerCase().contains(textToFind)) {869 if (mainMenuItem.getAction() != null && mainMenuItem.getText().toLowerCase(Locale.getDefault()).contains(textToFind)) { 868 870 result.add(mainMenuItem); 869 871 } … … 887 889 if (menuItem == null) continue; 888 890 889 if (menuItem.getAction()!=null && menuItem.getText().toLowerCase().contains(textToFind)) { 891 // Explicitely use default locale in this case, because we're looking for translated strings 892 if (menuItem.getAction() != null && menuItem.getText().toLowerCase(Locale.getDefault()).contains(textToFind)) { 890 893 result.add(menuItem); 891 894 } … … 1007 1010 //TODO: perform some delay (maybe 200 ms) before actual searching. 1008 1011 void doSearch(String searchTerm) { 1009 searchTerm = searchTerm.trim().toLowerCase(); 1012 // Explicitely use default locale in this case, because we're looking for translated strings 1013 searchTerm = searchTerm.trim().toLowerCase(Locale.getDefault()); 1010 1014 1011 1015 if (searchTerm.equals(currentSearchText)) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java
r8390 r8404 374 374 } else if (m.group(7) != null) { 375 375 sb.append('x'); // cardinal direction 376 String c = m.group(7).toUpperCase( );376 String c = m.group(7).toUpperCase(Locale.ENGLISH); 377 377 if ("N".equals(c) || "S".equals(c) || "E".equals(c) || "W".equals(c)) { 378 378 list.add(c); -
trunk/src/org/openstreetmap/josm/gui/download/BookmarkList.java
r8390 r8404 11 11 import java.util.LinkedList; 12 12 import java.util.List; 13 import java.util.Locale; 13 14 14 15 import javax.swing.DefaultListModel; … … 73 74 @Override 74 75 public int compareTo(Bookmark b) { 75 return name.toLowerCase( ).compareTo(b.name.toLowerCase());76 return name.toLowerCase(Locale.ENGLISH).compareTo(b.name.toLowerCase(Locale.ENGLISH)); 76 77 } 77 78 -
trunk/src/org/openstreetmap/josm/gui/io/UploadStrategy.java
r6990 r8404 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 import java.util.Locale; 5 7 6 8 import org.openstreetmap.josm.Main; … … 28 30 public static UploadStrategy fromPreference(String preferenceValue) { 29 31 if (preferenceValue == null) return null; 30 preferenceValue = preferenceValue.trim().toLowerCase( );32 preferenceValue = preferenceValue.trim().toLowerCase(Locale.ENGLISH); 31 33 for (UploadStrategy strategy: values()) { 32 34 if (strategy.getPreferenceValue().equals(preferenceValue)) … … 76 78 v = ""; 77 79 } 78 v = v.trim().toLowerCase( );80 v = v.trim().toLowerCase(Locale.ENGLISH); 79 81 if ("true".equals(v)) 80 82 return SINGLE_REQUEST_STRATEGY; -
trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
r8384 r8404 25 25 import java.util.Iterator; 26 26 import java.util.List; 27 import java.util.Locale; 27 28 import java.util.Set; 28 29 import java.util.concurrent.locks.Condition; … … 1064 1065 public boolean isProjectionSupported(Projection proj) { 1065 1066 List<String> serverProjections = info.getServerProjections(); 1066 return serverProjections.contains(proj.toCode().toUpperCase( ))1067 return serverProjections.contains(proj.toCode().toUpperCase(Locale.ENGLISH)) 1067 1068 || ("EPSG:3857".equals(proj.toCode()) && (serverProjections.contains("EPSG:4326") || serverProjections.contains("CRS:84"))) 1068 1069 || ("EPSG:4326".equals(proj.toCode()) && serverProjections.contains("CRS:84")); -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r8394 r8404 79 79 import org.openstreetmap.josm.tools.GBC; 80 80 import org.openstreetmap.josm.tools.ImageProvider; 81 import org.openstreetmap.josm.tools.Utils; 81 82 import org.openstreetmap.josm.tools.date.DateUtils; 82 83 import org.openstreetmap.josm.tools.date.PrimaryDateParser; … … 144 145 FileFilter filter = new FileFilter(){ 145 146 @Override public boolean accept(File f) { 146 return f.isDirectory() 147 || f .getName().toLowerCase().endsWith(".gpx") 148 || f.getName().toLowerCase().endsWith(".gpx.gz"); 147 return f.isDirectory() || Utils.hasExtension(f, "gpx", "gpx.gz"); 149 148 } 150 149 @Override public String getDescription() { … … 214 213 215 214 private InputStream createInputStream(File sel) throws IOException, FileNotFoundException { 216 if ( sel.getName().toLowerCase().endsWith(".gpx.gz")) {215 if (Utils.hasExtension(sel, "gpx.gz")) { 217 216 return new GZIPInputStream(new FileInputStream(sel)); 218 217 } else { -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/JpegFileFilter.java
r8378 r8404 5 5 6 6 import java.io.File; 7 8 import org.openstreetmap.josm.tools.Utils; 7 9 8 10 class JpegFileFilter extends javax.swing.filechooser.FileFilter implements java.io.FileFilter { … … 18 20 return true; 19 21 } else { 20 String name = f.getName().toLowerCase(); 21 return name.endsWith(".jpg") || name.endsWith(".jpeg"); 22 return Utils.hasExtension(f, "jpg", "jpeg"); 22 23 } 23 24 } -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java
r8308 r8404 71 71 @Override 72 72 public boolean accept(File f) { 73 return f.isDirectory() || f.getName().toLowerCase().endsWith(".wav");73 return f.isDirectory() || Utils.hasExtension(f, "wav"); 74 74 } 75 75 -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportImagesAction.java
r8338 r8404 22 22 import org.openstreetmap.josm.io.JpgImporter; 23 23 import org.openstreetmap.josm.tools.ImageProvider; 24 import org.openstreetmap.josm.tools.Utils; 24 25 25 26 public class ImportImagesAction extends AbstractAction { … … 41 42 if (f.isDirectory()) { 42 43 addRecursiveFiles(files, f.listFiles()); 43 } else if ( f.getName().toLowerCase().endsWith(".jpg")) {44 } else if (Utils.hasExtension(f, "jpg")) { 44 45 files.add(f); 45 46 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/Keyword.java
r7083 r8404 2 2 package org.openstreetmap.josm.gui.mappaint; 3 3 4 import java.util.Locale; 4 5 import java.util.Objects; 5 6 … … 8 9 9 10 public Keyword(String val) { 10 this.val = val.toLowerCase( );11 this.val = val.toLowerCase(Locale.ENGLISH); 11 12 } 12 13 -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r8394 r8404 287 287 if (zipEntryPath != null) 288 288 return new XmlStyleSource(entry); 289 if ( entry.url.toLowerCase().endsWith(".mapcss"))289 if (Utils.hasExtension(entry.url, "mapcss")) 290 290 return new MapCSSStyleSource(entry); 291 if ( entry.url.toLowerCase().endsWith(".xml"))291 if (Utils.hasExtension(entry.url, "xml")) 292 292 return new XmlStyleSource(entry); 293 293 else { -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj
r8331 r8404 14 14 import java.util.Collections; 15 15 import java.util.List; 16 import java.util.Locale; 16 17 17 18 import org.openstreetmap.josm.Main; … … 388 389 ( <PP_NOT> { invert = true; } pp_w() )? 389 390 ( 390 t=<IDENT> { mediatype = t.image.toLowerCase( ); } pp_w()391 t=<IDENT> { mediatype = t.image.toLowerCase(Locale.ENGLISH); } pp_w() 391 392 ( <PP_AND> pp_w() e=pp_media_expression() { pass = pass && e; } pp_w() )* 392 393 | -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
r8373 r8404 19 19 import java.util.Iterator; 20 20 import java.util.List; 21 import java.util.Locale; 21 22 import java.util.Map; 22 23 import java.util.Map.Entry; … … 102 103 try { 103 104 SUPPORTED_KEYS.add((String) f.get(null)); 104 if (!f.getName().toLowerCase( ).replace("_", "-").equals(f.get(null))) {105 if (!f.getName().toLowerCase(Locale.ENGLISH).replace("_", "-").equals(f.get(null))) { 105 106 throw new RuntimeException(f.getName()); 106 107 } -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java
r8308 r8404 15 15 import java.util.LinkedHashMap; 16 16 import java.util.List; 17 import java.util.Locale; 17 18 import java.util.Map; 18 19 import java.util.Map.Entry; … … 49 50 import org.openstreetmap.josm.gui.widgets.JosmTextField; 50 51 import org.openstreetmap.josm.tools.GBC; 52 import org.openstreetmap.josm.tools.Utils; 51 53 52 54 /** … … 191 193 @Override 192 194 public boolean accept(File f) { 193 return f.isDirectory() || f.getName().toLowerCase().endsWith(".xml");195 return f.isDirectory() || Utils.hasExtension(f, "xml"); 194 196 } 195 197 @Override … … 435 437 436 438 // Make 'wmsplugin cache' search for e.g. 'cache.wmsplugin' 437 final String prefKeyLower = prefKey.toLowerCase( );438 final String prefValueLower = prefValue.toLowerCase( );439 final String prefKeyLower = prefKey.toLowerCase(Locale.ENGLISH); 440 final String prefValueLower = prefValue.toLowerCase(Locale.ENGLISH); 439 441 for (String bit : input) { 440 bit = bit.toLowerCase( );442 bit = bit.toLowerCase(Locale.ENGLISH); 441 443 if (!prefKeyLower.contains(bit) && !prefValueLower.contains(bit)) { 442 444 canHas = false; -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileAction.java
r8378 r8404 8 8 import java.util.ArrayList; 9 9 import java.util.List; 10 import java.util.Locale; 10 11 import java.util.Map; 11 12 … … 21 22 import org.openstreetmap.josm.data.Preferences.Setting; 22 23 import org.openstreetmap.josm.gui.widgets.AbstractFileChooser; 24 import org.openstreetmap.josm.tools.Utils; 23 25 24 26 /** … … 65 67 @Override 66 68 public boolean accept(File f) { 67 return f.isDirectory() || f.getName().toLowerCase().endsWith(".xml") && f.getName().toLowerCase().startsWith(schemaKey);69 return f.isDirectory() || Utils.hasExtension(f, "xml") && f.getName().toLowerCase(Locale.ENGLISH).startsWith(schemaKey); 68 70 } 69 71 @Override -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java
r8377 r8404 11 11 import java.util.LinkedList; 12 12 import java.util.List; 13 import java.util.Locale; 13 14 import java.util.Map; 14 15 import java.util.Map.Entry; … … 155 156 @Override 156 157 public int compare(PluginInformation o1, PluginInformation o2) { 157 String n1 = o1.getName() == null ? "" : o1.getName().toLowerCase( );158 String n2 = o2.getName() == null ? "" : o2.getName().toLowerCase( );158 String n1 = o1.getName() == null ? "" : o1.getName().toLowerCase(Locale.ENGLISH); 159 String n2 = o2.getName() == null ? "" : o2.getName().toLowerCase(Locale.ENGLISH); 159 160 return n1.compareTo(n2); 160 161 } -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginUpdatePolicyPanel.java
r8388 r8404 9 9 import java.awt.Insets; 10 10 import java.util.EnumMap; 11 import java.util.Locale; 11 12 import java.util.Map; 12 13 … … 46 47 static Policy fromPreferenceValue(String preferenceValue) { 47 48 if (preferenceValue == null) return null; 48 preferenceValue = preferenceValue.trim().toLowerCase( );49 preferenceValue = preferenceValue.trim().toLowerCase(Locale.ENGLISH); 49 50 for (Policy p: Policy.values()) { 50 51 if (p.getPreferencesValue().equals(preferenceValue)) -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java
r8399 r8404 13 13 import java.util.Comparator; 14 14 import java.util.List; 15 import java.util.Locale; 15 16 import java.util.regex.Matcher; 16 17 import java.util.regex.Pattern; … … 164 165 private void updateFilter() { 165 166 filteredData.clear(); 166 String filterTxt = filter.getText().trim().toLowerCase( );167 String filterTxt = filter.getText().trim().toLowerCase(Locale.ENGLISH); 167 168 for (String code : data) { 168 if (code.toLowerCase( ).contains(filterTxt)) {169 if (code.toLowerCase(Locale.ENGLISH).contains(filterTxt)) { 169 170 filteredData.add(code); 170 171 } -
trunk/src/org/openstreetmap/josm/gui/preferences/server/ProxyPreferencesPanel.java
r8388 r8404 16 16 import java.net.ProxySelector; 17 17 import java.util.EnumMap; 18 import java.util.Locale; 18 19 import java.util.Map; 19 20 … … 74 75 public static ProxyPolicy fromName(String policyName) { 75 76 if (policyName == null) return null; 76 policyName = policyName.trim().toLowerCase( );77 policyName = policyName.trim().toLowerCase(Locale.ENGLISH); 77 78 for(ProxyPolicy pp: values()) { 78 79 if (pp.getName().equals(policyName)) -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetSelector.java
r8376 r8404 22 22 import java.util.Iterator; 23 23 import java.util.List; 24 import java.util.Locale; 24 25 import java.util.Objects; 25 26 import java.util.Set; … … 135 136 TaggingPreset group = preset.group; 136 137 while (group != null) { 137 Collections.addAll(groups, group.getLocaleName().toLowerCase( ).split("\\s"));138 Collections.addAll(groups, group.getLocaleName().toLowerCase(Locale.ENGLISH).split("\\s")); 138 139 group = group.group; 139 140 } 140 Collections.addAll(names, preset.getLocaleName().toLowerCase( ).split("\\s"));141 Collections.addAll(names, preset.getLocaleName().toLowerCase(Locale.ENGLISH).split("\\s")); 141 142 for (TaggingPresetItem item: preset.data) { 142 143 if (item instanceof KeyedItem) { … … 165 166 boolean foundFirst = false; 166 167 for (String value: values) { 167 int index = value.toLowerCase( ).indexOf(word);168 int index = value.toLowerCase(Locale.ENGLISH).indexOf(word); 168 169 if (index == 0) { 169 170 foundFirst = true; … … 329 330 private synchronized void filterPresets() { 330 331 //TODO Save favorites to file 331 String text = edSearchText.getText().toLowerCase( );332 String text = edSearchText.getText().toLowerCase(Locale.ENGLISH); 332 333 boolean onlyApplicable = ckOnlyApplicable != null && ckOnlyApplicable.isSelected(); 333 334 boolean inTags = ckSearchInTags != null && ckSearchInTags.isSelected(); -
trunk/src/org/openstreetmap/josm/gui/util/RotationAngle.java
r8394 r8404 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.util; 3 4 import java.util.Locale; 3 5 4 6 import org.openstreetmap.josm.data.osm.Node; … … 55 57 */ 56 58 public static double parseCardinalRotation(final String cardinal) { 57 switch (cardinal.toLowerCase( )) {59 switch (cardinal.toLowerCase(Locale.ENGLISH)) { 58 60 case "n": 59 61 case "north": -
trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java
r8390 r8404 38 38 import java.util.List; 39 39 import java.util.ListIterator; 40 import java.util.Locale; 40 41 import java.util.Map; 41 42 … … 1188 1189 throwParseException(st, "invalid node type"); 1189 1190 } 1190 String nodeType = st.sval.toUpperCase( );1191 String nodeType = st.sval.toUpperCase(Locale.ENGLISH); 1191 1192 if ("LEAF".equals(nodeType)) { 1192 1193 parseLeaf(st, parent); -
trunk/src/org/openstreetmap/josm/io/JpgImporter.java
r7178 r8404 16 16 import org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer; 17 17 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 18 import org.openstreetmap.josm.tools.Utils; 18 19 19 20 /** … … 105 106 } 106 107 } else { 107 if ( f.getName().toLowerCase().endsWith(".jpg")) {108 if (Utils.hasExtension(f, "jpg")) { 108 109 files.add(f); 109 110 } -
trunk/src/org/openstreetmap/josm/io/imagery/WMSGrabber.java
r8345 r8404 209 209 // [1] https://www.epsg-registry.org/report.htm?type=selection&entity=urn:ogc:def:crs:EPSG::4326&reportDetail=short&style=urn:uuid:report-style:default-with-code&style_name=OGP%20Default%20With%20Code&title=EPSG:4326 210 210 boolean switchLatLon = false; 211 if (baseURL.toLowerCase( ).contains("crs=epsg:4326")) {211 if (baseURL.toLowerCase(Locale.ENGLISH).contains("crs=epsg:4326")) { 212 212 switchLatLon = true; 213 } else if (baseURL.toLowerCase( ).contains("crs=") && "EPSG:4326".equals(myProj)) {213 } else if (baseURL.toLowerCase(Locale.ENGLISH).contains("crs=") && "EPSG:4326".equals(myProj)) { 214 214 switchLatLon = true; 215 215 } -
trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
r8390 r8404 15 15 import java.util.HashSet; 16 16 import java.util.List; 17 import java.util.Locale; 17 18 import java.util.Set; 18 19 import java.util.regex.Pattern; … … 263 264 String crs = (String) getContent(child); 264 265 if (!crs.isEmpty()) { 265 String upperCase = crs.trim().toUpperCase( );266 String upperCase = crs.trim().toUpperCase(Locale.ENGLISH); 266 267 crsList.add(upperCase); 267 268 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/DNSName.java
r8394 r8404 161 161 @Override 162 162 public int hashCode() { 163 return name.toUpperCase( ).hashCode();163 return name.toUpperCase(Locale.ENGLISH).hashCode(); 164 164 } 165 165 -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpsServer.java
r8377 r8404 28 28 import java.util.Date; 29 29 import java.util.Enumeration; 30 import java.util.Locale; 30 31 import java.util.Vector; 31 32 … … 117 118 private static GeneralName createGeneralName(String t, String v) throws IOException { 118 119 GeneralNameInterface gn; 119 switch (t.toLowerCase( )) {120 switch (t.toLowerCase(Locale.ENGLISH)) { 120 121 case "uri": gn = new URIName(v); break; 121 122 case "dns": gn = new DNSName(v); break; -
trunk/src/org/openstreetmap/josm/io/session/SessionImporter.java
r7937 r8404 13 13 import org.openstreetmap.josm.io.FileImporter; 14 14 import org.openstreetmap.josm.io.IllegalDataException; 15 import org.openstreetmap.josm.tools.Utils; 15 16 16 17 /** … … 35 36 @Override 36 37 public void importData(File file, ProgressMonitor progressMonitor) throws IOException, IllegalDataException { 37 boolean zip = file.getName().toLowerCase().endsWith(".joz");38 boolean zip = Utils.hasExtension(file, "joz"); 38 39 Main.worker.submit(new Loader(file, zip)); 39 40 } -
trunk/src/org/openstreetmap/josm/io/session/SessionReader.java
r8394 r8404 582 582 while (entries.hasMoreElements()) { 583 583 ZipEntry entry = entries.nextElement(); 584 if ( entry.getName().toLowerCase().endsWith(".jos")) {584 if (Utils.hasExtension(entry.getName(), "jos")) { 585 585 josEntry = entry; 586 586 break; -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r8390 r8404 28 28 import java.util.LinkedList; 29 29 import java.util.List; 30 import java.util.Locale; 30 31 import java.util.Map; 31 32 import java.util.Map.Entry; … … 380 381 // check whether automatic update at startup was disabled 381 382 // 382 String policy = Main.pref.get(togglePreferenceKey, "ask").trim().toLowerCase( );383 String policy = Main.pref.get(togglePreferenceKey, "ask").trim().toLowerCase(Locale.ENGLISH); 383 384 switch(policy) { 384 385 case "never": … … 1408 1409 public void initDontShowAgain(String preferencesKey) { 1409 1410 String policy = Main.pref.get(preferencesKey, "ask"); 1410 policy = policy.trim().toLowerCase( );1411 policy = policy.trim().toLowerCase(Locale.ENGLISH); 1411 1412 cbDontShowAgain.setSelected(!"ask".equals(policy)); 1412 1413 } -
trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java
r8395 r8404 19 19 import java.util.LinkedList; 20 20 import java.util.List; 21 import java.util.Locale; 21 22 import java.util.Map; 22 23 import java.util.TreeMap; … … 458 459 if (filter == null) return true; 459 460 if (value == null) return false; 460 return value.toLowerCase( ).contains(filter.toLowerCase());461 return value.toLowerCase(Locale.ENGLISH).contains(filter.toLowerCase(Locale.ENGLISH)); 461 462 } 462 463 -
trunk/src/org/openstreetmap/josm/tools/ColorHelper.java
r8345 r8404 3 3 4 4 import java.awt.Color; 5 import java.util.Locale; 5 6 6 7 /** … … 40 41 private static String int2hex(int i) { 41 42 String s = Integer.toHexString(i / 16) + Integer.toHexString(i % 16); 42 return s.toUpperCase( );43 return s.toUpperCase(Locale.ENGLISH); 43 44 } 44 45 -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r8395 r8404 693 693 } 694 694 695 ImageType type = name.toLowerCase().endsWith(".svg") ? ImageType.SVG : ImageType.OTHER;695 ImageType type = Utils.hasExtension(name, "svg") ? ImageType.SVG : ImageType.OTHER; 696 696 697 697 if (name.startsWith(HTTP_PROTOCOL) || name.startsWith(HTTPS_PROTOCOL)) { -
trunk/src/org/openstreetmap/josm/tools/LanguageInfo.java
r8284 r8404 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.tools; 3 4 import static org.openstreetmap.josm.tools.I18n.trc;5 3 6 4 import java.util.Collection; … … 55 53 return null; 56 54 } else if(code.matches(".+@.+")) { 57 return code.substring(0,1).toUpperCase( ) + code.substring(1,2)58 + "-" + code.substring(3,4).toUpperCase( ) + code.substring(4) + ":";59 } 60 return code.substring(0,1).toUpperCase( ) + code.substring(1) + ":";55 return code.substring(0,1).toUpperCase(Locale.ENGLISH) + code.substring(1,2) 56 + "-" + code.substring(3,4).toUpperCase(Locale.ENGLISH) + code.substring(4) + ":"; 57 } 58 return code.substring(0,1).toUpperCase(Locale.ENGLISH) + code.substring(1) + ":"; 61 59 } 62 60 … … 88 86 * to identify the locale of a localized resource, but in some cases it may use the 89 87 * programmatic name for locales, as replied by {@link Locale#toString()}. 90 * 88 * 91 89 * For unknown country codes and variants this function already does fallback to 92 90 * internally known translations. … … 191 189 return want.equals(newLanguage) || (!want.equals(oldLanguage) && newLanguage.startsWith("en")); 192 190 } 193 191 194 192 /** 195 193 * Replies the language prefix for use in XML elements (with a dot appended). -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r8390 r8404 32 32 import java.util.Collection; 33 33 import java.util.List; 34 import java.util.Locale; 34 35 import java.util.Properties; 35 36 … … 501 502 for (FontEntry entry: extrasPref) { 502 503 Collection<String> fontsAvail = getInstalledFonts(); 503 if (fontsAvail != null && fontsAvail.contains(entry.file.toUpperCase( ))) {504 if (fontsAvail != null && fontsAvail.contains(entry.file.toUpperCase(Locale.ENGLISH))) { 504 505 if (!allCharSubsets.contains(entry.charset)) { 505 506 allCharSubsets.add(entry.charset); -
trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
r8379 r8404 50 50 import java.util.Enumeration; 51 51 import java.util.List; 52 import java.util.Locale; 52 53 53 54 import javax.swing.JOptionPane; … … 320 321 Path filename = p.getFileName(); 321 322 if (filename != null) { 322 fontsAvail.add(filename.toString().toUpperCase( ));323 fontsAvail.add(filename.toString().toUpperCase(Locale.ENGLISH)); 323 324 } 324 325 } -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r8390 r8404 42 42 import java.util.Iterator; 43 43 import java.util.List; 44 import java.util.Locale; 44 45 import java.util.concurrent.ExecutorService; 45 46 import java.util.concurrent.Executors; … … 1206 1207 if (value != null) { 1207 1208 String old = System.setProperty(key, value); 1208 if (!key.toLowerCase( ).contains("password")) {1209 if (!key.toLowerCase(Locale.ENGLISH).contains("password")) { 1209 1210 Main.debug("System property '"+key+"' set to '"+value+"'. Old value was '"+old+"'"); 1210 1211 } else { … … 1251 1252 } 1252 1253 } 1254 1255 /** 1256 * Determines if the filename has one of the given extensions, in a robust manner. 1257 * The comparison is case and locale insensitive. 1258 * @param filename The file name 1259 * @param extensions The list of extensions to look for (without dot) 1260 * @return {@code true} if the filename has one of the given extensions 1261 * @since 8404 1262 */ 1263 public static boolean hasExtension(String filename, String ... extensions) { 1264 String name = filename.toLowerCase(Locale.ENGLISH); 1265 for (String ext : extensions) 1266 if (name.endsWith("."+ext.toLowerCase(Locale.ENGLISH))) 1267 return true; 1268 return false; 1269 } 1270 1271 /** 1272 * Determines if the file's name has one of the given extensions, in a robust manner. 1273 * The comparison is case and locale insensitive. 1274 * @param file The file 1275 * @param extensions The list of extensions to look for (without dot) 1276 * @return {@code true} if the file's name has one of the given extensions 1277 * @since 8404 1278 */ 1279 public static boolean hasExtension(File file, String ... extensions) { 1280 return hasExtension(file.getName(), extensions); 1281 } 1253 1282 } -
trunk/src/org/openstreetmap/josm/tools/template_engine/Variable.java
r8390 r8404 3 3 4 4 import java.util.Collection; 5 import java.util.Locale; 5 6 6 7 public class Variable implements TemplateEntry { … … 14 15 15 16 public Variable(String variableName) { 16 if (variableName.toLowerCase( ).startsWith(SPECIAL_VARIABLE_PREFIX)) {17 if (variableName.toLowerCase(Locale.ENGLISH).startsWith(SPECIAL_VARIABLE_PREFIX)) { 17 18 this.variableName = variableName.substring(SPECIAL_VARIABLE_PREFIX.length()); 18 19 // special:special:key means that real key named special:key is needed, not special variable 19 this.special = !this.variableName.toLowerCase( ).startsWith(SPECIAL_VARIABLE_PREFIX);20 this.special = !this.variableName.toLowerCase(Locale.ENGLISH).startsWith(SPECIAL_VARIABLE_PREFIX); 20 21 } else { 21 22 this.variableName = variableName;
Note:
See TracChangeset
for help on using the changeset viewer.