NO-JIRA - Update SimpleString to give a more useful error message

Currently we get.
java.lang.IndexOutOfBoundsException: null
at org.apache.activemq.artemis.api.core.SimpleString.readSimpleString(SimpleString.java:183)
at org.apache.activemq.artemis.api.core.SimpleString$ByteBufSimpleStringPool.create(SimpleString.java:584)
....

Should be
java.lang.IndexOutOfBoundsException: Error reading in simpleString, length=YYY is greater than readableBytes=XXX
at org.apache.activemq.artemis.api.core.SimpleString.readSimpleString(SimpleString.java:183)
at org.apache.activemq.artemis.api.core.SimpleString$ByteBufSimpleStringPool.create(SimpleString.java:584)
...
This commit is contained in:
henock 2018-09-11 14:48:17 +01:00 committed by GitHub
parent fe8a4b78c2
commit 153e0a0260
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -180,7 +180,7 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl
public static SimpleString readSimpleString(final ByteBuf buffer, final int length) {
if (length > buffer.readableBytes()) {
throw new IndexOutOfBoundsException();
throw new IndexOutOfBoundsException("Error reading in simpleString, length=" + length + " is greater than readableBytes=" + buffer.readableBytes());
}
byte[] data = new byte[length];
buffer.readBytes(data);