From ddb75e31e7310fba5382b634ccbeeeac4bf3c273 Mon Sep 17 00:00:00 2001 From: Joe DiPol Date: Fri, 11 Nov 2022 02:44:22 -0800 Subject: [PATCH] 2.x Add info to Charbuf exceptions (#5368) (#5376) * Add info to exceptions --- .../java/io/helidon/reactive/media/common/CharBuffer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reactive/media/common/src/main/java/io/helidon/reactive/media/common/CharBuffer.java b/reactive/media/common/src/main/java/io/helidon/reactive/media/common/CharBuffer.java index fea8ba513aa..e67d39af81e 100644 --- a/reactive/media/common/src/main/java/io/helidon/reactive/media/common/CharBuffer.java +++ b/reactive/media/common/src/main/java/io/helidon/reactive/media/common/CharBuffer.java @@ -44,7 +44,9 @@ public CharBuffer() { @Override public void write(char[] cbuf, int off, int len) { if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) - cbuf.length > 0)) { - throw new IndexOutOfBoundsException(); + throw new IndexOutOfBoundsException( + "Could not write array (cbuf.length=" + cbuf.length + " off=" + off + " len=" + len + ") " + + "into buffer (buffer.length=" + buffer.length + " count=" + count + ")"); } ensureCapacity(count + len); System.arraycopy(cbuf, off, buffer, count, len); @@ -95,7 +97,7 @@ private void grow(int minCapacity) { private static int hugeCapacity(int minCapacity) { if (minCapacity < 0) { - throw new OutOfMemoryError(); + throw new OutOfMemoryError("Capacity overflow. minCapacity=" + minCapacity); } return (minCapacity > MAX_ARRAY_SIZE) ? Integer.MAX_VALUE