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

No specifications available for locale specific data.

    Details

      Description



      Name: dfC67450 Date: 02/13/98



      No specifications are available for locale specific data. Because of
      total absence of any specifications for locale date pattern, number pattern,
      month names etc. it is impossible to write JCK tests for classes
      java.txt.***Format.


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

      Name: mgC56079 Date: 02/23/98



      The JCK tests are not (and are not going to be) based on the internal
      representation of locale-specific data (java.text.resources package).
      But the tests have to be based on the data itself because
      many of the i18n-related methods (NumberFormat.getInstance(),
      DateFormatSymbols.getMonthNames(), DateFormat.getDateInstance() etc)
      depend on this data.

      The intent of the JCK tests is to verify that these methods return the same
      values in all implementations. The tests should be based on specification.

      The problem is that different JDK builds produce different results and
      it is not clear from specification which output is correct.
      It should be specified what output to expect in each supported locale
      for each particular method call (this means the locale-specific data should
      be documented in some way).

      It should also be specified which locales are required to be supported by any
      implementation and which are optional (but should be compatible with specification
      and reference implementation if supported).

      The following are examples of the differences between jdk1.1.4 and jdk1.2:
      --- ErasTest.java ---
      import java.text.*;
      import java.util.*;

      class ErasTest {
          public static void main(String[] args) {
              Locale locale = Locale.CANADA_FRENCH;
              DateFormatSymbols dfs = new DateFormatSymbols(locale);
              String eras[] = dfs.getEras();
              System.out.println("locale: " + locale.getLanguage() + "_"
                                          + locale.getCountry());
              System.out.println("Eras: {\"" + eras[0] + "\", \"" + eras[1] + "\"}");
          }
      }
      ---------output for jdk1.1.4 -----------
      locale: fr_CA
      Eras: {"BC", "AD"}
      ----------------------------------------
      ---------output for jdk1.1.6 , jdk1.2beta3G -----------
      locale: fr_CA
      Eras: {"BC", "ap. J.-C."}
      ----------------------------------------

      Yet another test demonstrating the changes:

      --- CurrencyInstanceTest.java ---
        
      import java.text.*;
      import java.util.*;

      class CurrencyInstanceTest {
          public static void main(String[] args) {
              Locale locale;
              double num;

                // Italian locale
              locale = Locale.ITALIAN;
              num = 123.567;
              System.out.println("locale: " + locale.getLanguage() + "_"
                                          + locale.getCountry());
              System.out.println(num + " is formatted as: \"" +
                NumberFormat.getCurrencyInstance(locale).format(num) + "\"");

                // Italian locale
              locale = Locale.JAPANESE;
              num = 333.777;
              System.out.println("locale: " + locale.getLanguage() + "_"
                                          + locale.getCountry());
              System.out.println(num + " is formatted as: \"" +
                NumberFormat.getCurrencyInstance(locale).format(num) + "\"");
          }
      }
      ---------output for jdk1.1.4 -----------
      locale: it_
      123.567 is formatted as: "L. 123,57"
      locale: ja_
      333.777 is formatted as: "¥334"
      ----------------------------------------
      ---------output for jdk1.1.6, jdk1.2beta3G -----------
      locale: it_
      123.567 is formatted as: "L. 124"
      locale: ja_
      333.777 is formatted as: "¥333.78"
      ----------------------------------------


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

        Attachments

          Activity

            People

            • Assignee:
              bcbeck Brian Beck (Inactive)
              Reporter:
              dfazunensunw Dmitri Fazunenko (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: