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

java.util.Locale.getISO3Language() works wrong for non ISO-639 codes

XMLWordPrintable

    • 1.2fcs
    • sparc
    • solaris_2.5
    • Verified



      Name: avC70361 Date: 06/10/98



        The java.util.Locale.getISO3Language() works wrong for some codes which are
      not ISO-639 language codes. It returns String result instead of throwing
      MissingResourceException according to the specs: "Throws
      MissingResourceException if the three-letter language abbreviation is not
      available for this locale".

      Here is a test demonstrating the bug.
      ---------------ISO3LanguageTest.java----------
      import java.util.Locale;
      import java.util.MissingResourceException;

      public class ISO3LanguageTest {
        public static void main(String args[]) {
          Locale locale = new Locale("ttt", "");

          try {
            String result = locale.getISO3Language();

            System.out.println(
              "Failed: getISO3Language() returns wrong result : " + result + "\n" +
              "for locale \"" + locale + "\""
            );
          } catch(MissingResourceException e) {
            System.out.println("Passed");
          }
        }
      }
      ----------The test example---------
      > java ISO3LanguageTest
      Failed: getISO3Language() returns wrong result : tat
      for locale "ttt"

      ======================================================================

            rgillamsunw Richard Gillam (Inactive)
            ovlasov Oleksandr Vlasov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: