< prev index next >
src/java.base/share/classes/java/text/CalendarBuilder.java
Print this page
rev 57535 : 8235699: ArrayIndexOutOfBoundsException in CalendarBuilder.toString
Reviewed-by: phh, alanb, weijun, simonis
Contributed-by: verghese@amazon.com
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -146,13 +146,13 @@
return cal;
}
public String toString() {
StringJoiner sj = new StringJoiner(",", "CalendarBuilder:[", "]");
- for (int i = 0; i < field.length; i++) {
+ for (int i = 0; i < MAX_FIELD; i++) {
if (isSet(i)) {
- sj.add(i + "=" + field[MAX_FIELD + i]);
+ sj.add(i + "=" + field[i] + ":" + field[MAX_FIELD + i]);
}
}
return sj.toString();
}
< prev index next >