Skip to content

Commit 4f39bd0

Browse files
committed
Minor tweaks
1 parent c499978 commit 4f39bd0

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/main/java/com/fasterxml/jackson/core/base/ParserBase.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,16 +1554,20 @@ protected ContentReference _contentReferenceRedacted() {
15541554
return ContentReference.redacted();
15551555
}
15561556

1557-
protected static int[] growArrayBy(int[] arr, int more) throws StreamConstraintsException
1557+
/* Helper method called by name-decoding methods that require storage
1558+
* for "quads" (4-byte units encode as ints), when existing buffer
1559+
* is full.
1560+
*/
1561+
protected static int[] growArrayBy(int[] arr, int more) throws IllegalArgumentException
15581562
{
15591563
if (arr == null) {
15601564
return new int[more];
15611565
}
1562-
final long len = arr.length + more;
1563-
if (len > Integer.MAX_VALUE) {
1564-
throw new StreamConstraintsException("Unable to grow array to longer to Integer.MAX_VALUE");
1566+
final int len = arr.length + more;
1567+
if (len < 0) {
1568+
throw new IllegalArgumentException("Unable to grow array to longer to `Integer.MAX_VALUE`");
15651569
}
1566-
return Arrays.copyOf(arr, (int) len);
1570+
return Arrays.copyOf(arr, len);
15671571
}
15681572

15691573
/*

0 commit comments

Comments
 (0)