You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2019/12/05 22:46:22 UTC
[commons-codec] branch master updated: [CODEC-261]: Test Hex encode
of a read-only ByteBuffer.
This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git
The following commit(s) were added to refs/heads/master by this push:
new d7a4a02 [CODEC-261]: Test Hex encode of a read-only ByteBuffer.
d7a4a02 is described below
commit d7a4a0290ecaf06be09c1a0c9c35c0a38994c63d
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Thu Dec 5 22:46:19 2019 +0000
[CODEC-261]: Test Hex encode of a read-only ByteBuffer.
The test passes and this is no longer an issue.
---
src/test/java/org/apache/commons/codec/binary/HexTest.java | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/test/java/org/apache/commons/codec/binary/HexTest.java b/src/test/java/org/apache/commons/codec/binary/HexTest.java
index 3f52b01..7ec1243 100644
--- a/src/test/java/org/apache/commons/codec/binary/HexTest.java
+++ b/src/test/java/org/apache/commons/codec/binary/HexTest.java
@@ -620,6 +620,16 @@ public class HexTest {
assertEquals(0, bb.remaining());
}
+ /**
+ * Test encoding of a read only byte buffer.
+ * See CODEC-261.
+ */
+ @Test
+ public void testEncodeHexReadOnlyByteBuffer() {
+ final char[] chars = Hex.encodeHex(ByteBuffer.wrap(new byte[]{10}).asReadOnlyBuffer());
+ assertEquals("0a", String.valueOf(chars));
+ }
+
@Test
public void testEncodeStringEmpty() throws EncoderException {
assertTrue(Arrays.equals(new char[0], (char[]) new Hex().encode("")));