Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8149565

-locale option issues

XMLWordPrintable

    • b19
    • Verified

        -locale option issues:
        Language length is limited by 2 symbols (see jdk.javadoc.internal.tool.Start.getLocale(String localeName)):
                ............................................................
                } else if (firstuscore == -1 && localeName.length() == 2) {
                    language = localeName;
                } else {
                    usageError("main.malformed_locale_name", localeName);
                ............................................................
        Incorrect code in searchLocale() method:
               for (Locale loc : Locale.getAvailableLocales()) {
                    if (loc.getLanguage().equals(language) &&
                        (country == null || loc.getCountry().equals(country)) &&
                        (variant == null || loc.getVariant().equals(variant))) {
                        return loc;
                    }
                    ............................................................
        The country code of the "loc" variable is ignored so the "en_US" locale can be selected instead of "US".

        (Probably it would be better to use Locale.forLanguageTag(String)).

              jjg Jonathan Gibbons
              ogb Oleg Barbashov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: