Skip to content

Commit 1789396

Browse files
committed
Fix checkstyle, javadoc, and error-prone findings from precommit
1 parent d71835a commit 1789396

File tree

11 files changed

+17
-22
lines changed

11 files changed

+17
-22
lines changed

hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,8 +2367,8 @@ public static void zero(byte[] b, int offset, int length) {
23672367
* Fill given array with random bytes.
23682368
* @param b array which needs to be filled with random bytes
23692369
* <p>
2370-
* If you want random bytes generated by a strong source of randomness use
2371-
* {@link Bytes#secureRandom(byte[])}.
2370+
* If you want random bytes generated by a strong source of randomness use {@link
2371+
* Bytes#secureRandom(byte[])}.
23722372
* @param b array which needs to be filled with random bytes
23732373
*/
23742374
public static void random(byte[] b) {
@@ -2378,8 +2378,8 @@ public static void random(byte[] b) {
23782378
/**
23792379
* Fill given array with random bytes at the specified position.
23802380
* <p>
2381-
* If you want random bytes generated by a strong source of randomness use
2382-
* {@link Bytes#secureRandom(byte[], int, int).
2381+
* If you want random bytes generated by a strong source of randomness use {@link
2382+
* Bytes#secureRandom(byte[], int, int)}.
23832383
* @param b array which needs to be filled with random bytes
23842384
* @param offset staring offset in array
23852385
* @param length number of bytes to fill

hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestDDLMasterFailover.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ protected NamespaceDescriptor selectNamespace(
260260
return null;
261261
}
262262
ArrayList<String> namespaceList = new ArrayList<>(namespaceMap.keySet());
263-
String randomKey = namespaceList.get(ThreadLocalRandom.current().nextInt(namespaceList.size()));
263+
String randomKey = namespaceList.get(ThreadLocalRandom.current()
264+
.nextInt(namespaceList.size()));
264265
NamespaceDescriptor randomNsd = namespaceMap.get(randomKey);
265266
// remove from namespaceMap
266267
namespaceMap.remove(randomKey);
@@ -439,8 +440,9 @@ void perform() throws IOException {
439440
}
440441

441442
private TableDescriptor createTableDesc() {
442-
String tableName = String.format("ittable-%010d", ThreadLocalRandom.current().nextInt());
443-
String familyName = "cf-" + Math.abs(ThreadLocalRandom.current().nextInt());
443+
String tableName = String.format("ittable-%010d",
444+
ThreadLocalRandom.current().nextInt(Integer.MAX_VALUE));
445+
String familyName = "cf-" + ThreadLocalRandom.current().nextInt(Integer.MAX_VALUE);
444446
return TableDescriptorBuilder.newBuilder(TableName.valueOf(tableName))
445447
.setColumnFamily(ColumnFamilyDescriptorBuilder.of(familyName))
446448
.build();
@@ -601,7 +603,7 @@ void perform() throws IOException {
601603
try {
602604
ColumnFamilyDescriptor cfd = createFamilyDesc();
603605
if (selected.hasColumnFamily(cfd.getName())){
604-
LOG.info(new String(cfd.getName()) + " already exists in table "
606+
LOG.info(Bytes.toString(cfd.getName()) + " already exists in table "
605607
+ selected.getTableName());
606608
return;
607609
}
@@ -799,7 +801,7 @@ void perform() throws IOException {
799801
return;
800802
}
801803
byte[] family = cfd.getName();
802-
byte[] qualifier = Bytes.toBytes("col-" + ThreadLocalRandom.current().nextInt() % 10);
804+
byte[] qualifier = Bytes.toBytes("col-" + ThreadLocalRandom.current().nextInt(10));
803805
Bytes.random(value);
804806
Put put = new Put(rowKey);
805807
put.addColumn(family, qualifier, value);

hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/PrefetchExecutor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ public static void request(Path path, Runnable runnable) {
9191
long delay;
9292
if (prefetchDelayMillis > 0) {
9393
delay = (long)((prefetchDelayMillis * (1.0f - (prefetchDelayVariation/2))) +
94-
(prefetchDelayMillis * (prefetchDelayVariation/2) *
95-
ThreadLocalRandom.current().nextFloat()));
94+
(prefetchDelayMillis * (prefetchDelayVariation/2) *
95+
ThreadLocalRandom.current().nextFloat()));
9696
} else {
9797
delay = 0;
9898
}

hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1955,7 +1955,7 @@ public void loadRandomRows(final Table t, final byte[] f, int rowSize, int total
19551955
throws IOException {
19561956
for (int i = 0; i < totalRows; i++) {
19571957
byte[] row = new byte[rowSize];
1958-
Bytes.random(row);;
1958+
Bytes.random(row);
19591959
Put put = new Put(row);
19601960
put.addColumn(f, new byte[] { 0 }, new byte[] { 0 });
19611961
t.put(put);

hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTimestampsFilter.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343
import org.junit.Test;
4444
import org.junit.experimental.categories.Category;
4545
import org.junit.rules.TestName;
46-
import org.slf4j.Logger;
47-
import org.slf4j.LoggerFactory;
4846

4947
/**
5048
* Run tests related to {@link TimestampsFilter} using HBase client APIs.
@@ -58,7 +56,6 @@ public class TestTimestampsFilter {
5856
public static final HBaseClassTestRule CLASS_RULE =
5957
HBaseClassTestRule.forClass(TestTimestampsFilter.class);
6058

61-
private static final Logger LOG = LoggerFactory.getLogger(TestTimestampsFilter.class);
6259
private final static HBaseTestingUtil TEST_UTIL = new HBaseTestingUtil();
6360

6461
@Rule

hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionPlacement.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
import org.apache.hadoop.hbase.testclassification.MasterTests;
6565
import org.apache.hadoop.hbase.testclassification.MediumTests;
6666
import org.apache.hadoop.hbase.util.Bytes;
67-
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
6867
import org.apache.hadoop.hbase.util.Pair;
6968
import org.apache.zookeeper.KeeperException;
7069
import org.junit.AfterClass;

hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import java.util.List;
4040
import java.util.Map;
4141
import java.util.Objects;
42-
import java.util.Random;
4342
import org.apache.hadoop.conf.Configuration;
4443
import org.apache.hadoop.fs.FSDataOutputStream;
4544
import org.apache.hadoop.fs.Path;

hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSecureBulkloadListener.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
*/
1818
package org.apache.hadoop.hbase.regionserver;
1919

20+
import java.io.IOException;
21+
import java.util.UUID;
2022
import org.apache.hadoop.conf.Configuration;
2123
import org.apache.hadoop.fs.FSDataOutputStream;
2224
import org.apache.hadoop.fs.FileSystem;
@@ -42,8 +44,6 @@
4244
import org.junit.experimental.categories.Category;
4345
import org.junit.rules.TemporaryFolder;
4446
import org.junit.rules.TestName;
45-
import java.io.IOException;
46-
import java.util.UUID;
4747

4848
/**
4949
* Tests for failedBulkLoad logic to make sure staged files are returned to their original location

hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScannerClosure.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import java.util.TreeSet;
3131
import java.util.concurrent.CountDownLatch;
3232
import java.util.concurrent.ThreadLocalRandom;
33-
import java.util.concurrent.locks.ReentrantReadWriteLock;
3433
import org.apache.hadoop.conf.Configuration;
3534
import org.apache.hadoop.fs.FileSystem;
3635
import org.apache.hadoop.fs.Path;

hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/compactions/TestFIFOCompactionPolicy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private HStore prepareData() throws IOException {
105105
for (int i = 0; i < 10; i++) {
106106
for (int j = 0; j < 10; j++) {
107107
byte[] value = new byte[128 * 1024];
108-
Bytes.random(value);;
108+
Bytes.random(value);
109109
table.put(new Put(Bytes.toBytes(i * 10 + j)).addColumn(family, qualifier, value));
110110
}
111111
admin.flush(tableName);

0 commit comments

Comments
 (0)