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

BuddhistCalendar: set(year) can not set year before 543 correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P5 P5
    • None
    • 1.4.2
    • core-libs

      BuddhistCalendar:set(year) can not set year before 543 correctly

      when set year below 543, the output from get is different from what is set.

      compile and run the attached code:
      import java.util.*;
      import java.text.*;

      public class SetTest{
         public static void main(String[] args){
            Calendar budcal = Calendar.getInstance(new Locale("th", "TH"));
            
            budcal.set(Calendar.YEAR, 200);
            System.out.println("Year:"+budcal.get(Calendar.YEAR));
            budcal.set(Calendar.YEAR, 543);
            System.out.println("Year:"+budcal.get(Calendar.YEAR));
            budcal.set(Calendar.YEAR, 544);
            System.out.println("Year:"+budcal.get(Calendar.YEAR));
            budcal.set(Calendar.YEAR, 2000);
            System.out.println("Year:"+budcal.get(Calendar.YEAR));
           
            budcal.set(300, Calendar.APRIL, 10);
            System.out.println("Year:"+budcal.get(Calendar.YEAR));
            budcal.set(543, Calendar.APRIL, 10);
            System.out.println("Year:"+budcal.get(Calendar.YEAR));
            budcal.set(544, Calendar.APRIL, 10);
            System.out.println("Year:"+budcal.get(Calendar.YEAR));
            budcal.set(3001, Calendar.APRIL, 10);
            System.out.println("Year:"+budcal.get(Calendar.YEAR));
         }
      }
      =====
      the output is:
      Year:887(expecting 200)
      Year:544(expecting 543)
      Year:544(expecting 544)
      Year:2000
      Year:787(expecting 200)
      Year:544(expecting 543)
      Year:544(expecting 544)
      Year:3001

            okutsu Masayoshi Okutsu
            lzhanorcl Lichun Zhan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: