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

java.util.Locale class does not report localized Country US

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 6u10
    • globalization

      FULL PRODUCT VERSION :
      java version "1.6.0_21"
      Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
      Java HotSpot(TM) Client VM (build 17.0-b16, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP Professional SP3

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Default locale used is "nl","NL"

      A DESCRIPTION OF THE PROBLEM :
      When using the getDisplayCountry method to determine a country name according to another locale, the country name is not always returned

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1 compile and run the code and look at the results.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      United States in french: Etats-Unis
      United States in dutch: Verinigde Staten
      The Netherlands in french: Pays-Bas
      The Netherlands in dutch: Nederland
      France in english: France
      France in dutch: Frankrijk
      ACTUAL -
      United States in french: Etats-Unis
      United States in dutch: United States
      The Netherlands in french: Pays-Bas
      The Netherlands in dutch: Nederland
      France in english: France
      France in dutch: France

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package mytestapp;

      import java.util.Locale;

      public class Main {

          public static void main(String[] args) {
              
              Locale myLocUS = Locale.US;
              Locale myLocFR = Locale.FRANCE;
              Locale myDef = new Locale("nl","NL");
              
              System.out.println("United States in french: "+myLocUS.getDisplayCountry(myLocFR));
              // Below line should return "United States in dutch: Verenigde Staten"
              System.out.println("United States in dutch: "+myLocUS.getDisplayCountry(myDef));
              System.out.println("The Netherlands in french: "+myDef.getDisplayCountry(myLocFR));
              System.out.println("The Netherlands in dutch: "+myDef.getDisplayCountry(myDef));
              System.out.println("France in english: "+myLocFR.getDisplayCountry(myLocUS));
              // Below line should return "France in dutch: Frankrijk"
              System.out.println("France in dutch: "+myLocFR.getDisplayCountry(myDef));
          }
      }

      ---------- END SOURCE ----------

            yhuang Yong Huang (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: