Hi Clive, 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, Volker On Fri, Dec 13, 2019 at 1:05 AM Verghese, Clive <vergh...@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. > > Regards, > Clive Verghese > > From: "Verghese, Clive" <vergh...@amazon.com> > Date: Thursday, December 12, 2019 at 2:07 PM > To: "core-libs-dev@openjdk.java.net" <core-libs-dev@openjdk.java.net> > Subject: RFR 8235699 : ArrayIndexOutOfBoundsException in > CalendarBuilder.toString > > Hi, > > 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. > > Regards, > Clive Verghese > >