You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2018/11/06 16:21:43 UTC
qpid-proton-j git commit: PROTON-1941: throw BOE in the BB wrapper,
preserve historic encoding behaviour for compatibility
Repository: qpid-proton-j
Updated Branches:
refs/heads/master 83609c475 -> 5217e35ed
PROTON-1941: throw BOE in the BB wrapper, preserve historic encoding behaviour for compatibility
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/5217e35e
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/5217e35e
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/5217e35e
Branch: refs/heads/master
Commit: 5217e35eda03a4b5773c07e6b0728edc6f95d8bf
Parents: 83609c4
Author: Robbie Gemmell <ro...@apache.org>
Authored: Tue Nov 6 16:19:58 2018 +0000
Committer: Robbie Gemmell <ro...@apache.org>
Committed: Tue Nov 6 16:19:58 2018 +0000
----------------------------------------------------------------------
.../java/org/apache/qpid/proton/codec/WritableBuffer.java | 4 +++-
.../java/org/apache/qpid/proton/codec/WritableBufferTest.java | 7 ++++---
2 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/5217e35e/proton-j/src/main/java/org/apache/qpid/proton/codec/WritableBuffer.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec/WritableBuffer.java b/proton-j/src/main/java/org/apache/qpid/proton/codec/WritableBuffer.java
index 034a23e..1dcae28 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/codec/WritableBuffer.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/codec/WritableBuffer.java
@@ -145,9 +145,11 @@ public interface WritableBuffer {
}
if (_buf.remaining() < remaining) {
- throw new IndexOutOfBoundsException(String.format(
+ IndexOutOfBoundsException cause = new IndexOutOfBoundsException(String.format(
"Requested min remaining bytes(%d) exceeds remaining(%d) in underlying ByteBuffer: %s",
remaining, _buf.remaining(), _buf));
+
+ throw (BufferOverflowException) new BufferOverflowException().initCause(cause);
}
}
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/5217e35e/proton-j/src/test/java/org/apache/qpid/proton/codec/WritableBufferTest.java
----------------------------------------------------------------------
diff --git a/proton-j/src/test/java/org/apache/qpid/proton/codec/WritableBufferTest.java b/proton-j/src/test/java/org/apache/qpid/proton/codec/WritableBufferTest.java
index b3900bb..7509cf6 100644
--- a/proton-j/src/test/java/org/apache/qpid/proton/codec/WritableBufferTest.java
+++ b/proton-j/src/test/java/org/apache/qpid/proton/codec/WritableBufferTest.java
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import org.junit.Test;
@@ -80,7 +81,7 @@ public class WritableBufferTest {
}
@Test
- public void testEnsureReminingThrowsWhenExpected() {
+ public void testEnsureRemainingThrowsWhenExpected() {
ByteBuffer data = ByteBuffer.allocate(100);
WritableBuffer buffer = WritableBuffer.ByteBufferWrapper.wrap(data);
@@ -88,7 +89,7 @@ public class WritableBufferTest {
try {
buffer.ensureRemaining(1024);
fail("Should have thrown an error on request for more than is available.");
- } catch (IndexOutOfBoundsException iobe) {}
+ } catch (BufferOverflowException boe) {}
try {
buffer.ensureRemaining(-1);
@@ -97,7 +98,7 @@ public class WritableBufferTest {
}
@Test
- public void testEnsureReminingDefaultImplementation() {
+ public void testEnsureRemainingDefaultImplementation() {
WritableBuffer buffer = new DefaultWritableBuffer();
try {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org