[threeten-dev] A potential bug in JapaneseDate.of(Era era, int yearOfEra, int month, int dayOfMonth)
Frank Ding
dingxmin at linux.vnet.ibm.com
Wed May 1 23:12:41 PDT 2013
Hi Roger,
A full test is available @
http://cr.openjdk.java.net/~dingxmin/jsr310/JpDateTest.java. Please take
a look at it.
Best regards,
Frank
On 4/30/2013 5:56 AM, roger riggs wrote:
> Hi Frank,
>
> Thanks for the reports, we will followup. If the test case code is
> available
> it would be useful to integrate it into the existing java.time tests.
>
> Thanks, Roger
>
> On 4/27/2013 3:00 AM, Frank Ding wrote:
>> Hi Threeten guys,
>> Our Japanese test team found out a bug when calling
>> JapaneseDate.of(Era era, int yearOfEra, int month, int dayOfMonth).
>> See the code below.
>>
>> JapaneseDate date =
>> JapaneseDate.of(java.time.chrono.JapaneseEra.HEISEI, 1, 1, 7);
>>
>> Heisei era starts in Heisei 1/1/8 which implies Heisei 1/1/7 is
>> invalid. According to its spec [1],
>> It throws DateTimeException - if the value of any field is out of
>> range, or if the day-of-month is invalid for the month-year, or if
>> the date is not a Japanese era.
>> So the correct behavior is observing DateTimeException for the code
>> above. What's your opinion of it?
>>
>> Best regards,
>> Frank
>>
>> [1]
>> http://download.java.net/jdk8/docs/api/java/time/chrono/JapaneseDate.html#of%28java.time.chrono.Era,%20int,%20int,%20int%29
>>
>
More information about the threeten-dev
mailing list