JDK-4830072 : BuddhistCalendar: set(year) can not set year before 543 correctly
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 1.4.2
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2003-03-10
  • Updated: 2003-03-17
  • Resolved: 2003-03-17
Related Reports
Duplicate :  
Duplicate :  
Relates :  
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

Comments
EVALUATION This is a known restriction of the current BuddhistCalendar in 1.4.x. ###@###.### 2003-03-11 This should be fixed in a new implementation as a part of 4609228. ###@###.### 2003-03-11 If the fix is required in the current BuddhistCalendar, we need to replan the Thai buddhist calendar support plan in 4609228. Also, it's still unlikely to support the Chantarakati calendar and all the transitions in 4609228, which is required to support the dates of the test case correctly. ###@###.### 2003-03-14 The known limitations of BuddhistCalendar are now in 4833267. Closed as a duplicate. ###@###.### 2003-03-17
14-03-2003