HBASE-10023 Fix/Suppress all the 10 findbug warnings under hbase-common (Liang Xie)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1545257 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1b785677ba
commit
8c0078d175
|
@ -82,7 +82,7 @@ public class CellComparator implements Comparator<Cell>, Serializable{
|
||||||
if (c != 0) return c;
|
if (c != 0) return c;
|
||||||
|
|
||||||
//timestamp: later sorts first
|
//timestamp: later sorts first
|
||||||
c = -Longs.compare(a.getTimestamp(), b.getTimestamp());
|
c = Longs.compare(b.getTimestamp(), a.getTimestamp());
|
||||||
if (c != 0) return c;
|
if (c != 0) return c;
|
||||||
|
|
||||||
//type
|
//type
|
||||||
|
@ -90,7 +90,7 @@ public class CellComparator implements Comparator<Cell>, Serializable{
|
||||||
if (c != 0) return c;
|
if (c != 0) return c;
|
||||||
|
|
||||||
//mvccVersion: later sorts first
|
//mvccVersion: later sorts first
|
||||||
return -Longs.compare(a.getMvccVersion(), b.getMvccVersion());
|
return Longs.compare(b.getMvccVersion(), a.getMvccVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ public class CellComparator implements Comparator<Cell>, Serializable{
|
||||||
if (c != 0) return c;
|
if (c != 0) return c;
|
||||||
|
|
||||||
//timestamp: later sorts first
|
//timestamp: later sorts first
|
||||||
c = -Longs.compare(a.getTimestamp(), b.getTimestamp());
|
c = Longs.compare(b.getTimestamp(), a.getTimestamp());
|
||||||
if (c != 0) return c;
|
if (c != 0) return c;
|
||||||
|
|
||||||
//type
|
//type
|
||||||
|
|
|
@ -2055,7 +2055,7 @@ public class KeyValue implements Cell, HeapSize, Cloneable {
|
||||||
|
|
||||||
// compare Mvcc Version
|
// compare Mvcc Version
|
||||||
// Negate this comparison so later edits show up first
|
// Negate this comparison so later edits show up first
|
||||||
return -Longs.compare(left.getMvccVersion(), right.getMvccVersion());
|
return Longs.compare(right.getMvccVersion(), left.getMvccVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compareTimestamps(final KeyValue left, final KeyValue right) {
|
public int compareTimestamps(final KeyValue left, final KeyValue right) {
|
||||||
|
|
|
@ -156,11 +156,7 @@ abstract class BufferedDataBlockEncoder implements DataBlockEncoder {
|
||||||
public BufferedEncodedSeeker(KVComparator comparator,
|
public BufferedEncodedSeeker(KVComparator comparator,
|
||||||
HFileBlockDecodingContext decodingCtx) {
|
HFileBlockDecodingContext decodingCtx) {
|
||||||
this.comparator = comparator;
|
this.comparator = comparator;
|
||||||
if (comparator instanceof SamePrefixComparator) {
|
this.samePrefixComparator = comparator;
|
||||||
this.samePrefixComparator = (SamePrefixComparator<byte[]>) comparator;
|
|
||||||
} else {
|
|
||||||
this.samePrefixComparator = null;
|
|
||||||
}
|
|
||||||
this.decodingCtx = decodingCtx;
|
this.decodingCtx = decodingCtx;
|
||||||
if (decodingCtx.getHFileContext().isCompressTags()) {
|
if (decodingCtx.getHFileContext().isCompressTags()) {
|
||||||
try {
|
try {
|
||||||
|
@ -468,9 +464,7 @@ abstract class BufferedDataBlockEncoder implements DataBlockEncoder {
|
||||||
HFileBlockDefaultEncodingContext encodingCtx =
|
HFileBlockDefaultEncodingContext encodingCtx =
|
||||||
(HFileBlockDefaultEncodingContext) blkEncodingCtx;
|
(HFileBlockDefaultEncodingContext) blkEncodingCtx;
|
||||||
encodingCtx.prepareEncoding();
|
encodingCtx.prepareEncoding();
|
||||||
DataOutputStream dataOut =
|
DataOutputStream dataOut = encodingCtx.getOutputStreamForEncoder();
|
||||||
((HFileBlockDefaultEncodingContext) encodingCtx)
|
|
||||||
.getOutputStreamForEncoder();
|
|
||||||
if (encodingCtx.getHFileContext().isCompressTags()) {
|
if (encodingCtx.getHFileContext().isCompressTags()) {
|
||||||
try {
|
try {
|
||||||
TagCompressionContext tagCompressionContext = new TagCompressionContext(LRUDictionary.class);
|
TagCompressionContext tagCompressionContext = new TagCompressionContext(LRUDictionary.class);
|
||||||
|
|
|
@ -155,16 +155,10 @@ public class HFileContext implements HeapSize, Cloneable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HFileContext clone() {
|
public HFileContext clone() {
|
||||||
HFileContext clonnedCtx = new HFileContext();
|
try {
|
||||||
clonnedCtx.usesHBaseChecksum = this.usesHBaseChecksum;
|
return (HFileContext)(super.clone());
|
||||||
clonnedCtx.includesMvcc = this.includesMvcc;
|
} catch (CloneNotSupportedException e) {
|
||||||
clonnedCtx.includesTags = this.includesTags;
|
throw new AssertionError(); // Won't happen
|
||||||
clonnedCtx.compressAlgo = this.compressAlgo;
|
}
|
||||||
clonnedCtx.compressTags = this.compressTags;
|
|
||||||
clonnedCtx.checksumType = this.checksumType;
|
|
||||||
clonnedCtx.bytesPerChecksum = this.bytesPerChecksum;
|
|
||||||
clonnedCtx.blocksize = this.blocksize;
|
|
||||||
clonnedCtx.encoding = this.encoding;
|
|
||||||
return clonnedCtx;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,14 +190,12 @@ public class Bytes {
|
||||||
/**
|
/**
|
||||||
* Pass this to TreeMaps where byte [] are keys.
|
* Pass this to TreeMaps where byte [] are keys.
|
||||||
*/
|
*/
|
||||||
public static Comparator<byte []> BYTES_COMPARATOR =
|
public final static Comparator<byte []> BYTES_COMPARATOR = new ByteArrayComparator();
|
||||||
new ByteArrayComparator();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use comparing byte arrays, byte-by-byte
|
* Use comparing byte arrays, byte-by-byte
|
||||||
*/
|
*/
|
||||||
public static RawComparator<byte []> BYTES_RAWCOMPARATOR =
|
public final static RawComparator<byte []> BYTES_RAWCOMPARATOR = new ByteArrayComparator();
|
||||||
new ByteArrayComparator();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read byte-array written with a WritableableUtils.vint prefix.
|
* Read byte-array written with a WritableableUtils.vint prefix.
|
||||||
|
|
|
@ -49,7 +49,7 @@ public enum ChecksumType {
|
||||||
},
|
},
|
||||||
|
|
||||||
CRC32((byte)1) {
|
CRC32((byte)1) {
|
||||||
private volatile Constructor<?> ctor;
|
private transient Constructor<?> ctor;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|
|
@ -129,6 +129,9 @@ public class ConcatenatedLists<T> implements Collection<T> {
|
||||||
return new Iterator();
|
return new Iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@edu.umd.cs.findbugs.annotations.SuppressWarnings(
|
||||||
|
value="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD",
|
||||||
|
justification="nextWasCalled is using by StripeStoreFileManager")
|
||||||
public class Iterator implements java.util.Iterator<T> {
|
public class Iterator implements java.util.Iterator<T> {
|
||||||
protected int currentComponent = 0;
|
protected int currentComponent = 0;
|
||||||
protected int indexWithinComponent = -1;
|
protected int indexWithinComponent = -1;
|
||||||
|
|
|
@ -184,6 +184,9 @@ public class JVM {
|
||||||
* Workaround to get the current number of process running. Approach is the one described here:
|
* Workaround to get the current number of process running. Approach is the one described here:
|
||||||
* http://stackoverflow.com/questions/54686/how-to-get-a-list-of-current-open-windows-process-with-java
|
* http://stackoverflow.com/questions/54686/how-to-get-a-list-of-current-open-windows-process-with-java
|
||||||
*/
|
*/
|
||||||
|
@edu.umd.cs.findbugs.annotations.SuppressWarnings(
|
||||||
|
value="RV_DONT_JUST_NULL_CHECK_READLINE",
|
||||||
|
justification="used by testing")
|
||||||
public int getNumberOfRunningProcess(){
|
public int getNumberOfRunningProcess(){
|
||||||
if (!isUnix()){
|
if (!isUnix()){
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class KeyLocker<K extends Comparable<? super K>> {
|
||||||
static class KeyLock<K extends Comparable<? super K>> extends ReentrantLock {
|
static class KeyLock<K extends Comparable<? super K>> extends ReentrantLock {
|
||||||
private static final long serialVersionUID = -12432857283423584L;
|
private static final long serialVersionUID = -12432857283423584L;
|
||||||
|
|
||||||
private final KeyLocker<K> locker;
|
private final transient KeyLocker<K> locker;
|
||||||
private final K lockId;
|
private final K lockId;
|
||||||
|
|
||||||
private KeyLock(KeyLocker<K> locker, K lockId) {
|
private KeyLock(KeyLocker<K> locker, K lockId) {
|
||||||
|
|
Loading…
Reference in New Issue