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

java.util.Locale.getISO3Country() works wrong for non ISO-3166 codes

    Details

    • Subcomponent:
    • Resolved In Build:
      1.2fcs
    • CPU:
      sparc
    • OS:
      solaris_2.5
    • Verification:
      Verified

      Description



      Name: avC70361 Date: 06/10/98



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

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

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

          try {
            String result = locale.getISO3Country();

            System.out.println(
              "Failed: getISO3Country() returns wrong result : " + result + "\n" +
              "for locale \"" + locale + "\""
            );
          } catch(MissingResourceException e) {
            System.out.println("Passed");
          }
        }
      }
      ----------The test example---------
      > java ISO3CountryTest
      Failed: getISO3Country() returns wrong result : CCK
      for locale "_CCC"

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

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: