[threeten-dev] A potential bug in JapaneseDate.of(Era era, int yearOfEra, int month, int dayOfMonth)

roger riggs roger.riggs at oracle.com
Mon Apr 29 14:56:29 PDT 2013


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