RFR 8235699 : ArrayIndexOutOfBoundsException in CalendarBuilder.toString
verghese at amazon.com
Tue Dec 17 03:50:17 UTC 2019
Thank you for the feedback.
I have update the revision to reflect your comments.
On 12/13/19, 8:09 AM, "Volker Simonis" <volker.simonis at gmail.com> wrote:
nice catch :)
I think it would be better though to only iterate up to MAX_FIELD and
print "field[MAX_FIELD + i]", otherwise you may miss to print valid
fields. The reason is that with your current solution "isSet()" will
now be called not only for "stamp" fields, but also for "real" fields.
But for "real" fields, zero is a valid value which you might want to
print. You might however still consider printing the "stamps" (i.e.
the lower half) as well, e.g.:
sj.add(i + "=" + field[i] + ":" + field[MAX_FIELD + i]);
Thank you and best regards,
On Fri, Dec 13, 2019 at 1:05 AM Verghese, Clive <verghese at amazon.com> wrote:
> Additional information regarding the field array.
> It is meant to hold two arrays, the lower half holds the stamp. And the upper half holds the fields.
> The original implementation was intending to display the second half of the array. Though the outer loop
> iterated through the whole array. Therefore causing an ArrayIndexOutOfBoundsException. I have updated
> this to display the whole array.
> Clive Verghese
> From: "Verghese, Clive" <verghese at amazon.com>
> Date: Thursday, December 12, 2019 at 2:07 PM
> To: "core-libs-dev at openjdk.java.net" <core-libs-dev at openjdk.java.net>
> Subject: RFR 8235699 : ArrayIndexOutOfBoundsException in CalendarBuilder.toString
> Requesting review for
> JBS Issue : https://bugs.openjdk.java.net/browse/JDK-8235699
> Webrev : https://cr.openjdk.java.net/~phh/8235699/webrev.00/
> CalendarBuilder.toString method has a bug which causes an ArrayIndexOutOfBoundsException exception.
> The class is an internal jdk class that is restricted to java.text package. The bug is observed when the debugger
> reaches this class and uses the toString function to print the class.
> Steps to reproduce this is attached in the JBS issue.
> Clive Verghese
More information about the core-libs-dev