HBASE-5645 [findbugs] Fix correctness warnings (David S Wang and Uma Maheswara Rao G)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1324969 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a2ff41653a
commit
8575edd908
|
@ -38,4 +38,3 @@ cat jenkins.out | while read line; do
|
||||||
prevLine=$line
|
prevLine=$line
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
rm jenkins.out
|
|
||||||
|
|
|
@ -19,5 +19,5 @@ MAVEN_OPTS="-Xmx3g"
|
||||||
# Please update the per-module test-patch.properties if you update this file.
|
# Please update the per-module test-patch.properties if you update this file.
|
||||||
|
|
||||||
OK_RELEASEAUDIT_WARNINGS=84
|
OK_RELEASEAUDIT_WARNINGS=84
|
||||||
OK_FINDBUGS_WARNINGS=561
|
OK_FINDBUGS_WARNINGS=549
|
||||||
OK_JAVADOC_WARNINGS=169
|
OK_JAVADOC_WARNINGS=169
|
||||||
|
|
|
@ -558,9 +558,7 @@ public class HFile {
|
||||||
hfs = (HFileSystem)fs;
|
hfs = (HFileSystem)fs;
|
||||||
// open a stream to read data without checksum verification in
|
// open a stream to read data without checksum verification in
|
||||||
// the filesystem
|
// the filesystem
|
||||||
if (hfs != null) {
|
fsdisNoFsChecksum = hfs.getNoChecksumFs().open(path);
|
||||||
fsdisNoFsChecksum = hfs.getNoChecksumFs().open(path);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return pickReaderVersion(path, fsdis, fsdisNoFsChecksum,
|
return pickReaderVersion(path, fsdis, fsdisNoFsChecksum,
|
||||||
fs.getFileStatus(path).getLen(), closeIStream, cacheConf,
|
fs.getFileStatus(path).getLen(), closeIStream, cacheConf,
|
||||||
|
|
|
@ -127,8 +127,8 @@ public class CellCounter {
|
||||||
new IntWritable(1));
|
new IntWritable(1));
|
||||||
context.write(new Text(thisRowFamilyName), new IntWritable(1));
|
context.write(new Text(thisRowFamilyName), new IntWritable(1));
|
||||||
}
|
}
|
||||||
String thisRowQualifierName =
|
String thisRowQualifierName = thisRowFamilyName + separator
|
||||||
thisRowFamilyName + separator + Bytes.toStringBinary(value.getQualifier());
|
+ Bytes.toStringBinary(value.getQualifier());
|
||||||
if (thisRowQualifierName != null &&
|
if (thisRowQualifierName != null &&
|
||||||
!thisRowQualifierName.equals(currentQualifierName)) {
|
!thisRowQualifierName.equals(currentQualifierName)) {
|
||||||
currentQualifierName = thisRowQualifierName;
|
currentQualifierName = thisRowQualifierName;
|
||||||
|
@ -139,16 +139,16 @@ public class CellCounter {
|
||||||
// Intialize versions
|
// Intialize versions
|
||||||
context.getCounter("QL_VERSIONS", currentRowKey + separator +
|
context.getCounter("QL_VERSIONS", currentRowKey + separator +
|
||||||
thisRowQualifierName).increment(1);
|
thisRowQualifierName).increment(1);
|
||||||
context.write(new Text(currentRowKey + separator + thisRowQualifierName +
|
context.write(new Text(currentRowKey + separator
|
||||||
"_Versions"), new IntWritable(1));
|
+ thisRowQualifierName + "_Versions"), new IntWritable(1));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Increment versions
|
// Increment versions
|
||||||
currentQualifierName = thisRowQualifierName;
|
currentQualifierName = thisRowQualifierName;
|
||||||
context.getCounter("QL_VERSIONS", currentRowKey + separator +
|
context.getCounter("QL_VERSIONS", currentRowKey + separator +
|
||||||
thisRowQualifierName).increment(1);
|
thisRowQualifierName).increment(1);
|
||||||
context.write(new Text(currentRowKey + separator + thisRowQualifierName + "_Versions"),
|
context.write(new Text(currentRowKey + separator
|
||||||
new IntWritable(1));
|
+ thisRowQualifierName + "_Versions"), new IntWritable(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|
|
@ -927,7 +927,7 @@ public class AssignmentManager extends ZooKeeperListener {
|
||||||
return p.getFirst();
|
return p.getFirst();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
master.abort("Aborting because error occoured while reading "
|
master.abort("Aborting because error occoured while reading "
|
||||||
+ data.getRegionName() + " from .META.", e);
|
+ Bytes.toStringBinary(data.getRegionName()) + " from .META.", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1756,7 +1756,6 @@ public class AssignmentManager extends ZooKeeperListener {
|
||||||
boolean asyncSetOfflineInZooKeeper(final RegionState state,
|
boolean asyncSetOfflineInZooKeeper(final RegionState state,
|
||||||
final AsyncCallback.StringCallback cb, final Object ctx) {
|
final AsyncCallback.StringCallback cb, final Object ctx) {
|
||||||
if (!state.isClosed() && !state.isOffline()) {
|
if (!state.isClosed() && !state.isOffline()) {
|
||||||
new RuntimeException("Unexpected state trying to OFFLINE; " + state);
|
|
||||||
this.master.abort("Unexpected state trying to OFFLINE; " + state,
|
this.master.abort("Unexpected state trying to OFFLINE; " + state,
|
||||||
new IllegalStateException());
|
new IllegalStateException());
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -691,8 +691,8 @@ public class DefaultLoadBalancer implements LoadBalancer {
|
||||||
get(Bytes.toString(tableName));
|
get(Bytes.toString(tableName));
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException fnfe) {
|
} catch (FileNotFoundException fnfe) {
|
||||||
LOG.debug("FileNotFoundException during getTableDescriptors." +
|
LOG.debug("FileNotFoundException during getTableDescriptors."
|
||||||
" Current table name = " + tableName , fnfe);
|
+ " Current table name = " + Bytes.toStringBinary(tableName), fnfe);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tableDescriptor;
|
return tableDescriptor;
|
||||||
|
|
|
@ -256,7 +256,7 @@ Server {
|
||||||
// Creation of a HSA will force a resolve.
|
// Creation of a HSA will force a resolve.
|
||||||
InetSocketAddress initialIsa = new InetSocketAddress(hostname, port);
|
InetSocketAddress initialIsa = new InetSocketAddress(hostname, port);
|
||||||
if (initialIsa.getAddress() == null) {
|
if (initialIsa.getAddress() == null) {
|
||||||
throw new IllegalArgumentException("Failed resolve of " + this.isa);
|
throw new IllegalArgumentException("Failed resolve of " + initialIsa);
|
||||||
}
|
}
|
||||||
int numHandlers = conf.getInt("hbase.master.handler.count",
|
int numHandlers = conf.getInt("hbase.master.handler.count",
|
||||||
conf.getInt("hbase.regionserver.handler.count", 25));
|
conf.getInt("hbase.regionserver.handler.count", 25));
|
||||||
|
|
|
@ -533,7 +533,7 @@ public class ServerManager {
|
||||||
*/
|
*/
|
||||||
private HRegionInterface getServerConnection(final ServerName sn)
|
private HRegionInterface getServerConnection(final ServerName sn)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
HRegionInterface hri = this.serverConnections.get(sn.toString());
|
HRegionInterface hri = this.serverConnections.get(sn);
|
||||||
if (hri == null) {
|
if (hri == null) {
|
||||||
LOG.debug("New connection to " + sn.toString());
|
LOG.debug("New connection to " + sn.toString());
|
||||||
hri = this.connection.getHRegionConnection(sn.getHostname(), sn.getPort());
|
hri = this.connection.getHRegionConnection(sn.getHostname(), sn.getPort());
|
||||||
|
|
|
@ -259,9 +259,8 @@ public class MemStoreLAB {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Allocation(data=" + data +
|
return "Allocation(" + "capacity=" + data.length + ", off=" + offset
|
||||||
" with capacity=" + data.length +
|
+ ")";
|
||||||
", off=" + offset + ")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] getData() {
|
byte[] getData() {
|
||||||
|
|
|
@ -963,7 +963,7 @@ public class StoreFile extends SchemaConfigured {
|
||||||
.withPath(fs, path)
|
.withPath(fs, path)
|
||||||
.withBlockSize(blocksize)
|
.withBlockSize(blocksize)
|
||||||
.withCompression(compress)
|
.withCompression(compress)
|
||||||
.withDataBlockEncoder(dataBlockEncoder)
|
.withDataBlockEncoder(this.dataBlockEncoder)
|
||||||
.withComparator(comparator.getRawComparator())
|
.withComparator(comparator.getRawComparator())
|
||||||
.withChecksumType(checksumType)
|
.withChecksumType(checksumType)
|
||||||
.withBytesPerChecksum(bytesPerChecksum)
|
.withBytesPerChecksum(bytesPerChecksum)
|
||||||
|
|
|
@ -791,11 +791,6 @@ public class ReplicationSource extends Thread
|
||||||
return Long.valueOf(getTS(o1)).compareTo(getTS(o2));
|
return Long.valueOf(getTS(o1)).compareTo(getTS(o2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Split a path to get the start time
|
* Split a path to get the start time
|
||||||
* For example: 10.20.20.171%3A60020.1277499063250
|
* For example: 10.20.20.171%3A60020.1277499063250
|
||||||
|
|
|
@ -273,7 +273,7 @@ public class FSTableDescriptors implements TableDescriptors {
|
||||||
Path p = status[i].getPath();
|
Path p = status[i].getPath();
|
||||||
// Clean up old versions
|
// Clean up old versions
|
||||||
if (!fs.delete(p, false)) {
|
if (!fs.delete(p, false)) {
|
||||||
LOG.warn("Failed cleanup of " + status);
|
LOG.warn("Failed cleanup of " + p);
|
||||||
} else {
|
} else {
|
||||||
LOG.debug("Cleaned up old tableinfo file " + p);
|
LOG.debug("Cleaned up old tableinfo file " + p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -832,7 +832,7 @@ public abstract class FSUtils {
|
||||||
public boolean accept(Path p) {
|
public boolean accept(Path p) {
|
||||||
boolean isValid = false;
|
boolean isValid = false;
|
||||||
try {
|
try {
|
||||||
if (HConstants.HBASE_NON_USER_TABLE_DIRS.contains(p)) {
|
if (HConstants.HBASE_NON_USER_TABLE_DIRS.contains(p.toString())) {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
} else {
|
} else {
|
||||||
isValid = this.fs.getFileStatus(p).isDir();
|
isValid = this.fs.getFileStatus(p).isDir();
|
||||||
|
|
|
@ -231,9 +231,8 @@ public class JVMClusterUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// regionServerThreads can never be null because they are initialized when
|
if (regionservers != null) {
|
||||||
// the class is constructed.
|
for (RegionServerThread t : regionservers) {
|
||||||
for(RegionServerThread t: regionservers) {
|
|
||||||
if (t.isAlive()) {
|
if (t.isAlive()) {
|
||||||
try {
|
try {
|
||||||
t.getRegionServer().stop("Shutdown requested");
|
t.getRegionServer().stop("Shutdown requested");
|
||||||
|
@ -243,6 +242,7 @@ public class JVMClusterUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (masters != null) {
|
if (masters != null) {
|
||||||
for (JVMClusterUtil.MasterThread t : masters) {
|
for (JVMClusterUtil.MasterThread t : masters) {
|
||||||
while (t.master.isAlive()) {
|
while (t.master.isAlive()) {
|
||||||
|
|
|
@ -192,8 +192,8 @@ public class PoolMap<K, V> implements Map<K, V> {
|
||||||
for (Map.Entry<K, Pool<V>> poolEntry : pools.entrySet()) {
|
for (Map.Entry<K, Pool<V>> poolEntry : pools.entrySet()) {
|
||||||
final K poolKey = poolEntry.getKey();
|
final K poolKey = poolEntry.getKey();
|
||||||
final Pool<V> pool = poolEntry.getValue();
|
final Pool<V> pool = poolEntry.getValue();
|
||||||
for (final V poolValue : pool.values()) {
|
if (pool != null) {
|
||||||
if (pool != null) {
|
for (final V poolValue : pool.values()) {
|
||||||
entries.add(new Map.Entry<K, V>() {
|
entries.add(new Map.Entry<K, V>() {
|
||||||
@Override
|
@Override
|
||||||
public K getKey() {
|
public K getKey() {
|
||||||
|
|
Loading…
Reference in New Issue