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

Wrong WEEK_OF_YEAR in Locale de

XMLWordPrintable

    • mantis
    • x86, sparc
    • solaris_2.6, windows_2000
    • Verified



        Name: yyT116575 Date: 10/24/2001


        java version "1.3.1"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
        Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

        Following main class computes first week in year 1999 in "de" wrong, when we
        setMinimalDaysInFirstWeek(4), the result is OK, but disagrees to bug
        description 4302061, where week 52 is documented as last week of 1998.


        import java.util.Calendar;
        import java.util.*;

        public class Test {
          public static void main(String [] args) {
            System.err.println("Version = "+System.getProperty("java.version")+
                ", CLASSPATH = "+System.getProperty("java.class.path"));
            System.err.println("Locale is: "+Locale.getDefault());
            Calendar c = Calendar.getInstance();
            c.set(Calendar.YEAR, 1999);
            //c.set(Calendar.DAY_OF_MONTH, 1);
            c.set(Calendar.DATE, 0);
            c.set(Calendar.MONTH, 0); // month is 0-n
            c.set(Calendar.HOUR, 0);
            c.set(Calendar.MINUTE, 0);
            c.set(Calendar.SECOND, 0);
            System.err.println("Minimal Days in First Week: "+c.getMinimalDaysInFirstWeek());
            System.err.println("WEEK_OF_YEAR is: "+c.get(Calendar.WEEK_OF_YEAR));
            System.err.println("Now setting locale minimal day in first week explicitely ...");
            c.setMinimalDaysInFirstWeek(4); // as it is in "de"
            c.setTime(c.getTime()); // refresh
            System.err.println("Minimal Days in First Week: "+c.getMinimalDaysInFirstWeek());
            System.err.println("WEEK_OF_YEAR is: "+c.get(Calendar.WEEK_OF_YEAR));
          }
        }


        ... brings following output:

        Version = 1.3.1, CLASSPATH = .;C:\software\jdk1.3
        \jre\lib\rt.jar;C:\software\jdk1.3\jre\lib\i18n.jar
        Locale is: de_AT
        Minimal Days in First Week: 1
        WEEK_OF_YEAR is: 1
        Now setting locale minimal day in first week explicitely ...
        Minimal Days in First Week: 4
        WEEK_OF_YEAR is: 53


        C:\> dir C:\software\kdk1.3\jre\lib

         Directory of C:\software\jdk1.3\jre\lib

        06.05.2001 04:19 2.765.521 i18n.jar
        06.05.2001 04:19 13.584.926 rt.jar
        (Review ID: 134366)
        ======================================================================

              kcolfersunw Kieran Colfer (Inactive)
              yyoungsunw Yung-ching Young (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: