Ignore:
Timestamp:
2015-05-21T01:18:35+02:00 (9 years ago)
Author:
Don-vip
Message:

When doing a String.toLowerCase()/toUpperCase() call, use a Locale. This avoids problems with certain locales, i.e. Lithuanian or Turkish. See PMD UseLocaleWithCaseConversions rule and String.toLowerCase() javadoc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r8392 r8404  
    3434import java.util.LinkedList;
    3535import java.util.List;
     36import java.util.Locale;
    3637import java.util.Map;
    3738import java.util.Set;
     
    206207
    207208        private Option(boolean requiresArgument) {
    208             this.name = name().toLowerCase().replace("_", "-");
     209            this.name = name().toLowerCase(Locale.ENGLISH).replace("_", "-");
    209210            this.requiresArg = requiresArgument;
    210211        }
     
    229230            Map<Option, Collection<String>> res = new EnumMap<>(Option.class);
    230231            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("-", "_"));
    232233                if (o != null) {
    233234                    res.put(o, e.getValue());
     
    509510            for (String s : args.get(Option.OFFLINE).iterator().next().split(",")) {
    510511                try {
    511                     Main.setOffline(OnlineResource.valueOf(s.toUpperCase()));
     512                    Main.setOffline(OnlineResource.valueOf(s.toUpperCase(Locale.ENGLISH)));
    512513                } catch (IllegalArgumentException e) {
    513514                    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())));
    515516                    System.exit(1);
    516517                    return;
Note: See TracChangeset for help on using the changeset viewer.