You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2018/09/11 17:54:34 UTC

activemq-artemis git commit: NO-JIRA - Update SimpleString to give a more useful error message

Repository: activemq-artemis
Updated Branches:
  refs/heads/2.6.x 410b3c1dd -> fda739c50


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)
...
(cherry picked from commit 153e0a0260c9b143a2ed21b80b4fc07af5f18428)


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/fda739c5
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/fda739c5
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/fda739c5

Branch: refs/heads/2.6.x
Commit: fda739c506ec002f42314ad9f5055a69488c544c
Parents: 410b3c1
Author: henock <he...@users.noreply.github.com>
Authored: Tue Sep 11 14:48:17 2018 +0100
Committer: Clebert Suconic <cl...@apache.org>
Committed: Tue Sep 11 13:54:26 2018 -0400

----------------------------------------------------------------------
 .../java/org/apache/activemq/artemis/api/core/SimpleString.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fda739c5/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java
index 96e48b8..aabffa1 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java
@@ -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);