Changeset 8404 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2015-05-21T01:18:35+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 7 edited
-
ColorHelper.java (modified) (2 diffs)
-
ImageProvider.java (modified) (1 diff)
-
LanguageInfo.java (modified) (4 diffs)
-
PlatformHookUnixoid.java (modified) (2 diffs)
-
PlatformHookWindows.java (modified) (2 diffs)
-
Utils.java (modified) (3 diffs)
-
template_engine/Variable.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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.
