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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P5
    • Resolution: Duplicate
    • Affects Version/s: 1.4.2
    • Fix Version/s: None
    • Component/s: core-libs

      Description

      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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: