You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2017/11/18 01:22:31 UTC
[03/30] hbase git commit: HBASE-19239 Fix findbugs and error-prone
issues
http://git-wip-us.apache.org/repos/asf/hbase/blob/c179d514/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestOrderedBytes.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestOrderedBytes.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestOrderedBytes.java
index 8f213b7..c5d661f 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestOrderedBytes.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestOrderedBytes.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.math.BigDecimal;
+import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collections;
@@ -871,7 +872,9 @@ public class TestOrderedBytes {
@Test
public void testBlobVar() {
byte[][] vals =
- { "".getBytes(), "foo".getBytes(), "foobarbazbub".getBytes(),
+ { "".getBytes(StandardCharsets.UTF_8),
+ "foo".getBytes(StandardCharsets.UTF_8),
+ "foobarbazbub".getBytes(StandardCharsets.UTF_8),
{ (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa,
(byte) 0xaa, /* 7 bytes of alternating bits; testing around HBASE-9893 */ },
{ (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa,
@@ -886,8 +889,14 @@ public class TestOrderedBytes {
{ (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55,
(byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55,
(byte) 0x55, (byte) 0x55, /* 14 bytes of alternating bits; testing around HBASE-9893 */ },
- "1".getBytes(), "22".getBytes(), "333".getBytes(), "4444".getBytes(),
- "55555".getBytes(), "666666".getBytes(), "7777777".getBytes(), "88888888".getBytes()
+ "1".getBytes(StandardCharsets.UTF_8),
+ "22".getBytes(StandardCharsets.UTF_8),
+ "333".getBytes(StandardCharsets.UTF_8),
+ "4444".getBytes(StandardCharsets.UTF_8),
+ "55555".getBytes(StandardCharsets.UTF_8),
+ "666666".getBytes(StandardCharsets.UTF_8),
+ "7777777".getBytes(StandardCharsets.UTF_8),
+ "88888888".getBytes(StandardCharsets.UTF_8)
};
/*
@@ -958,7 +967,9 @@ public class TestOrderedBytes {
@Test
public void testBlobCopy() {
byte[][] vals =
- { "".getBytes(), "foo".getBytes(), "foobarbazbub".getBytes(),
+ { "".getBytes(StandardCharsets.UTF_8),
+ "foo".getBytes(StandardCharsets.UTF_8),
+ "foobarbazbub".getBytes(StandardCharsets.UTF_8),
{ (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa,
(byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa },
{ (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55,
@@ -1033,9 +1044,9 @@ public class TestOrderedBytes {
byte[] a = new byte[3 + (Order.ASCENDING == ord ? 1 : 2) + 2];
PositionedByteRange buf =
new SimplePositionedMutableByteRange(a, 1, 3 + (Order.ASCENDING == ord ? 1 : 2));
- OrderedBytes.encodeBlobCopy(buf, "foobarbaz".getBytes(), 3, 3, ord);
+ OrderedBytes.encodeBlobCopy(buf, "foobarbaz".getBytes(StandardCharsets.UTF_8), 3, 3, ord);
buf.setPosition(0);
- assertArrayEquals("bar".getBytes(), OrderedBytes.decodeBlobCopy(buf));
+ assertArrayEquals("bar".getBytes(StandardCharsets.UTF_8), OrderedBytes.decodeBlobCopy(buf));
}
}
@@ -1239,7 +1250,7 @@ public class TestOrderedBytes {
buff.setPosition(0);
assertEquals(OrderedBytes.length(buff), cnt);
for (int i = 0; i < cnt; i++) {
- assertEquals(OrderedBytes.isEncodedValue(buff), true);
+ assertEquals(true, OrderedBytes.isEncodedValue(buff));
OrderedBytes.skip(buff);
}
}