From 6f798c6a9d7fd20e29665cb27e7947305305d37c Mon Sep 17 00:00:00 2001 From: Takeshi YAMAMURO Date: Thu, 26 Jan 2017 10:19:03 +0900 Subject: [PATCH] Fix wrong comments --- src/main/java/org/xerial/snappy/BitShuffle.java | 8 ++++---- src/test/java/org/xerial/snappy/BitShuffleTest.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/xerial/snappy/BitShuffle.java b/src/main/java/org/xerial/snappy/BitShuffle.java index 5c14c73..ede458f 100644 --- a/src/main/java/org/xerial/snappy/BitShuffle.java +++ b/src/main/java/org/xerial/snappy/BitShuffle.java @@ -53,7 +53,7 @@ public class BitShuffle * @param shuffled output of the shuffled data. Uses range [pos()..]. * @return byte size of the shuffled data. * @throws SnappyError when the input is not a direct buffer - * @throws IllegalArgumentException when the input length is not a multiple of a given type size + * @throws IllegalArgumentException when the input length is not a multiple of the given type size */ public static int bitShuffle(ByteBuffer input, BitShuffleType type, ByteBuffer shuffled) throws IOException { if (!input.isDirect()) { @@ -69,7 +69,7 @@ public class BitShuffle int uLen = input.remaining(); int typeSize = type.getTypeSize(); if (uLen % typeSize != 0) { - throw new IllegalArgumentException("input length must be a multiple of a given type size"); + throw new IllegalArgumentException("input length must be a multiple of the given type size: " + typeSize); } if (shuffled.remaining() < uLen) { throw new IllegalArgumentException("not enough space for output"); @@ -163,7 +163,7 @@ public class BitShuffle * @return byte size of the unshuffled data. * @throws IOException when failed to unshuffle the given input * @throws SnappyError when the input is not a direct buffer - * @throws IllegalArgumentException when the length of input shuffled data is not a multiple of a given type size + * @throws IllegalArgumentException when the length of input shuffled data is not a multiple of the given type size */ public static int bitUnShuffle(ByteBuffer shuffled, BitShuffleType type, ByteBuffer output) throws IOException { if (!shuffled.isDirect()) { @@ -179,7 +179,7 @@ public class BitShuffle int uLen = shuffled.remaining(); int typeSize = type.getTypeSize(); if (uLen % typeSize != 0) { - throw new IllegalArgumentException("length of input shuffled data must be a multiple of a given type size"); + throw new IllegalArgumentException("length of input shuffled data must be a multiple of the given type size: " + typeSize); } if (output.remaining() < uLen) { throw new IllegalArgumentException("not enough space for output"); diff --git a/src/test/java/org/xerial/snappy/BitShuffleTest.java b/src/test/java/org/xerial/snappy/BitShuffleTest.java index ab2bf3e..888b950 100644 --- a/src/test/java/org/xerial/snappy/BitShuffleTest.java +++ b/src/test/java/org/xerial/snappy/BitShuffleTest.java @@ -88,13 +88,13 @@ public class BitShuffleTest { BitShuffle.bitShuffle(inputBuf, BitShuffleType.INT, outputBuf); fail("no expected exception happened"); } catch (IllegalArgumentException e) { - Assert.assertTrue(e.getMessage().equals("input length must be a multiple of a given type size")); + Assert.assertTrue(e.getMessage().startsWith("input length must be a multiple of the given type size")); } try { BitShuffle.bitUnShuffle(inputBuf, BitShuffleType.INT, outputBuf); fail("no expected exception happened"); } catch (IllegalArgumentException e) { - Assert.assertTrue(e.getMessage().equals("length of input shuffled data must be a multiple of a given type size")); + Assert.assertTrue(e.getMessage().startsWith("length of input shuffled data must be a multiple of the given type size")); } }