HBASE-18268 Eliminate the findbugs warnings for hbase-client

This commit is contained in:
Chia-Ping Tsai 2017-06-27 11:34:31 +08:00
parent bec34ae432
commit 8eaad67866
4 changed files with 13 additions and 9 deletions

View File

@ -1177,13 +1177,14 @@ public class HColumnDescriptor implements WritableComparable<HColumnDescriptor>
boolean hasConfigKeys = false;
// print all reserved keys first
for (ImmutableBytesWritable k : values.keySet()) {
for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> entry : values.entrySet()) {
ImmutableBytesWritable k = entry.getKey();
if (!RESERVED_KEYWORDS.contains(k)) {
hasConfigKeys = true;
continue;
}
String key = Bytes.toString(k.get());
String value = Bytes.toStringBinary(values.get(k).get());
String value = Bytes.toStringBinary(entry.getValue().get());
if (printDefaults
|| !DEFAULT_VALUES.containsKey(key)
|| !DEFAULT_VALUES.get(key).equalsIgnoreCase(value)) {
@ -1200,12 +1201,13 @@ public class HColumnDescriptor implements WritableComparable<HColumnDescriptor>
s.append(HConstants.METADATA).append(" => ");
s.append('{');
boolean printComma = false;
for (ImmutableBytesWritable k : values.keySet()) {
for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> entry : values.entrySet()) {
ImmutableBytesWritable k = entry.getKey();
if (RESERVED_KEYWORDS.contains(k)) {
continue;
}
String key = Bytes.toString(k.get());
String value = Bytes.toStringBinary(values.get(k).get());
String value = Bytes.toStringBinary(entry.getValue().get());
if (printComma) {
s.append(", ");
}

View File

@ -957,7 +957,8 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor> {
// step 1: set partitioning and pruning
Set<ImmutableBytesWritable> reservedKeys = new TreeSet<ImmutableBytesWritable>();
Set<ImmutableBytesWritable> userKeys = new TreeSet<ImmutableBytesWritable>();
for (ImmutableBytesWritable k : values.keySet()) {
for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> entry : values.entrySet()) {
ImmutableBytesWritable k = entry.getKey();
if (k == null || k.get() == null) continue;
String key = Bytes.toString(k.get());
// in this section, print out reserved keywords + coprocessor info
@ -966,7 +967,7 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor> {
continue;
}
// only print out IS_ROOT/IS_META if true
String value = Bytes.toString(values.get(k).get());
String value = Bytes.toString(entry.getValue().get());
if (key.equalsIgnoreCase(IS_ROOT) || key.equalsIgnoreCase(IS_META)) {
if (Boolean.valueOf(value) == false) continue;
}
@ -1175,8 +1176,7 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor> {
result = families.size() - other.families.size();
}
if (result == 0 && families.size() != other.families.size()) {
result = Integer.valueOf(families.size()).compareTo(
Integer.valueOf(other.families.size()));
result = Integer.compare(families.size(), other.families.size());
}
if (result == 0) {
for (Iterator<HColumnDescriptor> it = families.values().iterator(),

View File

@ -101,6 +101,8 @@ public abstract class AbstractRpcClient<T extends RpcConnection> implements RpcC
private static final ScheduledExecutorService IDLE_CONN_SWEEPER = Executors
.newScheduledThreadPool(1, Threads.newDaemonThreadFactory("Idle-Rpc-Conn-Sweeper"));
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="MS_MUTABLE_COLLECTION_PKGPROTECT",
justification="the rest of the system which live in the different package can use")
protected final static Map<Kind, TokenSelector<? extends TokenIdentifier>> TOKEN_HANDLERS = new HashMap<>();
static {

View File

@ -210,7 +210,7 @@ public class PoolMap<K, V> implements Map<K, V> {
}
}
}
return null;
return entries;
}
protected interface Pool<R> {