-
Bug
-
Resolution: Duplicate
-
P5
-
None
-
1.4.2
-
generic
-
generic
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
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
- duplicates
-
JDK-4830050 BuddhistCalendar: add(year) can't handle negative value after 543 year are left
- Closed
-
JDK-4833267 (cal) BuddhistCalendar problems
- Closed
- relates to
-
JDK-4609228 (cal) RFE: Provide additional local calendars in Java
- Resolved