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:
Jonathan Hsieh 2012-04-11 20:04:12 +00:00
parent a2ff41653a
commit 8575edd908
15 changed files with 23 additions and 33 deletions

View File

@ -38,4 +38,3 @@ cat jenkins.out | while read line; do
prevLine=$line
fi
done
rm jenkins.out

View File

@ -19,5 +19,5 @@ MAVEN_OPTS="-Xmx3g"
# Please update the per-module test-patch.properties if you update this file.
OK_RELEASEAUDIT_WARNINGS=84
OK_FINDBUGS_WARNINGS=561
OK_FINDBUGS_WARNINGS=549
OK_JAVADOC_WARNINGS=169

View File

@ -558,9 +558,7 @@ public class HFile {
hfs = (HFileSystem)fs;
// open a stream to read data without checksum verification in
// the filesystem
if (hfs != null) {
fsdisNoFsChecksum = hfs.getNoChecksumFs().open(path);
}
fsdisNoFsChecksum = hfs.getNoChecksumFs().open(path);
}
return pickReaderVersion(path, fsdis, fsdisNoFsChecksum,
fs.getFileStatus(path).getLen(), closeIStream, cacheConf,

View File

@ -127,8 +127,8 @@ public class CellCounter {
new IntWritable(1));
context.write(new Text(thisRowFamilyName), new IntWritable(1));
}
String thisRowQualifierName =
thisRowFamilyName + separator + Bytes.toStringBinary(value.getQualifier());
String thisRowQualifierName = thisRowFamilyName + separator
+ Bytes.toStringBinary(value.getQualifier());
if (thisRowQualifierName != null &&
!thisRowQualifierName.equals(currentQualifierName)) {
currentQualifierName = thisRowQualifierName;
@ -139,16 +139,16 @@ public class CellCounter {
// Intialize versions
context.getCounter("QL_VERSIONS", currentRowKey + separator +
thisRowQualifierName).increment(1);
context.write(new Text(currentRowKey + separator + thisRowQualifierName +
"_Versions"), new IntWritable(1));
context.write(new Text(currentRowKey + separator
+ thisRowQualifierName + "_Versions"), new IntWritable(1));
} else {
// Increment versions
currentQualifierName = thisRowQualifierName;
context.getCounter("QL_VERSIONS", currentRowKey + separator +
thisRowQualifierName).increment(1);
context.write(new Text(currentRowKey + separator + thisRowQualifierName + "_Versions"),
new IntWritable(1));
context.write(new Text(currentRowKey + separator
+ thisRowQualifierName + "_Versions"), new IntWritable(1));
}
}
} catch (InterruptedException e) {

View File

@ -927,7 +927,7 @@ public class AssignmentManager extends ZooKeeperListener {
return p.getFirst();
} catch (IOException e) {
master.abort("Aborting because error occoured while reading "
+ data.getRegionName() + " from .META.", e);
+ Bytes.toStringBinary(data.getRegionName()) + " from .META.", e);
return null;
}
}
@ -1756,7 +1756,6 @@ public class AssignmentManager extends ZooKeeperListener {
boolean asyncSetOfflineInZooKeeper(final RegionState state,
final AsyncCallback.StringCallback cb, final Object ctx) {
if (!state.isClosed() && !state.isOffline()) {
new RuntimeException("Unexpected state trying to OFFLINE; " + state);
this.master.abort("Unexpected state trying to OFFLINE; " + state,
new IllegalStateException());
return false;

View File

@ -691,8 +691,8 @@ public class DefaultLoadBalancer implements LoadBalancer {
get(Bytes.toString(tableName));
}
} catch (FileNotFoundException fnfe) {
LOG.debug("FileNotFoundException during getTableDescriptors." +
" Current table name = " + tableName , fnfe);
LOG.debug("FileNotFoundException during getTableDescriptors."
+ " Current table name = " + Bytes.toStringBinary(tableName), fnfe);
}
return tableDescriptor;

View File

@ -256,7 +256,7 @@ Server {
// Creation of a HSA will force a resolve.
InetSocketAddress initialIsa = new InetSocketAddress(hostname, port);
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",
conf.getInt("hbase.regionserver.handler.count", 25));

View File

@ -533,7 +533,7 @@ public class ServerManager {
*/
private HRegionInterface getServerConnection(final ServerName sn)
throws IOException {
HRegionInterface hri = this.serverConnections.get(sn.toString());
HRegionInterface hri = this.serverConnections.get(sn);
if (hri == null) {
LOG.debug("New connection to " + sn.toString());
hri = this.connection.getHRegionConnection(sn.getHostname(), sn.getPort());

View File

@ -259,9 +259,8 @@ public class MemStoreLAB {
@Override
public String toString() {
return "Allocation(data=" + data +
" with capacity=" + data.length +
", off=" + offset + ")";
return "Allocation(" + "capacity=" + data.length + ", off=" + offset
+ ")";
}
byte[] getData() {

View File

@ -963,7 +963,7 @@ public class StoreFile extends SchemaConfigured {
.withPath(fs, path)
.withBlockSize(blocksize)
.withCompression(compress)
.withDataBlockEncoder(dataBlockEncoder)
.withDataBlockEncoder(this.dataBlockEncoder)
.withComparator(comparator.getRawComparator())
.withChecksumType(checksumType)
.withBytesPerChecksum(bytesPerChecksum)

View File

@ -791,11 +791,6 @@ public class ReplicationSource extends Thread
return Long.valueOf(getTS(o1)).compareTo(getTS(o2));
}
@Override
public boolean equals(Object o) {
return true;
}
/**
* Split a path to get the start time
* For example: 10.20.20.171%3A60020.1277499063250

View File

@ -273,7 +273,7 @@ public class FSTableDescriptors implements TableDescriptors {
Path p = status[i].getPath();
// Clean up old versions
if (!fs.delete(p, false)) {
LOG.warn("Failed cleanup of " + status);
LOG.warn("Failed cleanup of " + p);
} else {
LOG.debug("Cleaned up old tableinfo file " + p);
}

View File

@ -832,7 +832,7 @@ public abstract class FSUtils {
public boolean accept(Path p) {
boolean isValid = false;
try {
if (HConstants.HBASE_NON_USER_TABLE_DIRS.contains(p)) {
if (HConstants.HBASE_NON_USER_TABLE_DIRS.contains(p.toString())) {
isValid = false;
} else {
isValid = this.fs.getFileStatus(p).isDir();

View File

@ -231,9 +231,8 @@ public class JVMClusterUtil {
}
}
}
// regionServerThreads can never be null because they are initialized when
// the class is constructed.
for(RegionServerThread t: regionservers) {
if (regionservers != null) {
for (RegionServerThread t : regionservers) {
if (t.isAlive()) {
try {
t.getRegionServer().stop("Shutdown requested");
@ -243,6 +242,7 @@ public class JVMClusterUtil {
}
}
}
}
if (masters != null) {
for (JVMClusterUtil.MasterThread t : masters) {
while (t.master.isAlive()) {

View File

@ -192,8 +192,8 @@ public class PoolMap<K, V> implements Map<K, V> {
for (Map.Entry<K, Pool<V>> poolEntry : pools.entrySet()) {
final K poolKey = poolEntry.getKey();
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>() {
@Override
public K getKey() {