Changeset 14013 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2018-07-08T01:29:16+02:00 (6 years ago)
Author:
Don-vip
Message:

see #16453 - fix NPE and warnings

Location:
trunk/src/org/openstreetmap/josm/tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/I18n.java

    r13790 r14013  
    9090    /** Map (english/locale) of plural strings **/
    9191    private static volatile Map<String, String[]> pstrings;
     92    private static Locale originalLocale = Locale.getDefault();
    9293    private static Map<String, PluralMode> languages = new HashMap<>();
    9394    static {
     
    635636        return new HashMap<>(pstrings);
    636637    }
     638
     639    /**
     640     * Returns the original default locale found when the JVM started.
     641     * Used to guess real language/country of current user disregarding language chosen in JOSM preferences.
     642     * @return the original default locale found when the JVM started
     643     * @since 14013
     644     */
     645    public static Locale getOriginalLocale() {
     646        return originalLocale;
     647    }
    637648}
  • trunk/src/org/openstreetmap/josm/tools/KeyboardUtils.java

    r14012 r14013  
    160160     */
    161161    public static List<Character> getCharactersForKey(char row, int column, Locale l) {
     162        if (l == null) {
     163            l = I18n.getOriginalLocale();
     164        }
    162165        if ('E' == row && 0 == column) {
    163166            List<Character> result = new ArrayList<>();
     
    258261                result.add('*');
    259262                break;
     263            default:
     264                // Do nothing
    260265            }
    261266
     
    286291                result.add('º'); // https://en.wikipedia.org/wiki/Ordinal_indicator
    287292                break;
     293            default:
     294                // Do nothing
    288295            }
    289296
     
    348355                addThaiCharacters(map);
    349356                break;
     357            default:
     358                // Do nothing
    350359        }
    351360
  • trunk/src/org/openstreetmap/josm/tools/Shortcut.java

    r14012 r14013  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.awt.Toolkit;
    76import java.awt.event.KeyEvent;
    87import java.util.ArrayList;
Note: See TracChangeset for help on using the changeset viewer.