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;
|
||||
|
||||
//timestamp: later sorts first
|
||||
c = -Longs.compare(a.getTimestamp(), b.getTimestamp());
|
||||
c = Longs.compare(b.getTimestamp(), a.getTimestamp());
|
||||
if (c != 0) return c;
|
||||
|
||||
//type
|
||||
|
@ -90,7 +90,7 @@ public class CellComparator implements Comparator<Cell>, Serializable{
|
|||
if (c != 0) return c;
|
||||
|
||||
//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;
|
||||
|
||||
//timestamp: later sorts first
|
||||
c = -Longs.compare(a.getTimestamp(), b.getTimestamp());
|
||||
c = Longs.compare(b.getTimestamp(), a.getTimestamp());
|
||||
if (c != 0) return c;
|
||||
|
||||
//type
|
||||
|
|
|
@ -2055,7 +2055,7 @@ public class KeyValue implements Cell, HeapSize, Cloneable {
|
|||
|
||||
// compare Mvcc Version
|
||||
// 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) {
|
||||
|
|
|
@ -156,11 +156,7 @@ abstract class BufferedDataBlockEncoder implements DataBlockEncoder {
|
|||
public BufferedEncodedSeeker(KVComparator comparator,
|
||||
HFileBlockDecodingContext decodingCtx) {
|
||||
this.comparator = comparator;
|
||||
if (comparator instanceof SamePrefixComparator) {
|
||||
this.samePrefixComparator = (SamePrefixComparator<byte[]>) comparator;
|
||||
} else {
|
||||
this.samePrefixComparator = null;
|
||||
}
|
||||
this.samePrefixComparator = comparator;
|
||||
this.decodingCtx = decodingCtx;
|
||||
if (decodingCtx.getHFileContext().isCompressTags()) {
|
||||
try {
|
||||
|
@ -468,9 +464,7 @@ abstract class BufferedDataBlockEncoder implements DataBlockEncoder {
|
|||
HFileBlockDefaultEncodingContext encodingCtx =
|
||||
(HFileBlockDefaultEncodingContext) blkEncodingCtx;
|
||||
encodingCtx.prepareEncoding();
|
||||
DataOutputStream dataOut =
|
||||
((HFileBlockDefaultEncodingContext) encodingCtx)
|
||||
.getOutputStreamForEncoder();
|
||||
DataOutputStream dataOut = encodingCtx.getOutputStreamForEncoder();
|
||||
if (encodingCtx.getHFileContext().isCompressTags()) {
|
||||
try {
|
||||
TagCompressionContext tagCompressionContext = new TagCompressionContext(LRUDictionary.class);
|
||||
|
|
|
@ -155,16 +155,10 @@ public class HFileContext implements HeapSize, Cloneable {
|
|||
|
||||
@Override
|
||||
public HFileContext clone() {
|
||||
HFileContext clonnedCtx = new HFileContext();
|
||||
clonnedCtx.usesHBaseChecksum = this.usesHBaseChecksum;
|
||||
clonnedCtx.includesMvcc = this.includesMvcc;
|
||||
clonnedCtx.includesTags = this.includesTags;
|
||||
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;
|
||||
try {
|
||||
return (HFileContext)(super.clone());
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new AssertionError(); // Won't happen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -190,14 +190,12 @@ public class Bytes {
|
|||
/**
|
||||
* Pass this to TreeMaps where byte [] are keys.
|
||||
*/
|
||||
public static Comparator<byte []> BYTES_COMPARATOR =
|
||||
new ByteArrayComparator();
|
||||
public final static Comparator<byte []> BYTES_COMPARATOR = new ByteArrayComparator();
|
||||
|
||||
/**
|
||||
* Use comparing byte arrays, byte-by-byte
|
||||
*/
|
||||
public static RawComparator<byte []> BYTES_RAWCOMPARATOR =
|
||||
new ByteArrayComparator();
|
||||
public final static RawComparator<byte []> BYTES_RAWCOMPARATOR = new ByteArrayComparator();
|
||||
|
||||
/**
|
||||
* Read byte-array written with a WritableableUtils.vint prefix.
|
||||
|
|
|
@ -49,7 +49,7 @@ public enum ChecksumType {
|
|||
},
|
||||
|
||||
CRC32((byte)1) {
|
||||
private volatile Constructor<?> ctor;
|
||||
private transient Constructor<?> ctor;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
|
|
@ -129,6 +129,9 @@ public class ConcatenatedLists<T> implements Collection<T> {
|
|||
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> {
|
||||
protected int currentComponent = 0;
|
||||
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:
|
||||
* 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(){
|
||||
if (!isUnix()){
|
||||
return 0;
|
||||
|
|
|
@ -117,7 +117,7 @@ public class KeyLocker<K extends Comparable<? super K>> {
|
|||
static class KeyLock<K extends Comparable<? super K>> extends ReentrantLock {
|
||||
private static final long serialVersionUID = -12432857283423584L;
|
||||
|
||||
private final KeyLocker<K> locker;
|
||||
private final transient KeyLocker<K> locker;
|
||||
private final K lockId;
|
||||
|
||||
private KeyLock(KeyLocker<K> locker, K lockId) {
|
||||
|
|
Loading…
Reference in New Issue