Project: Apache HBase - Server
FindBugs version: 3.1.0-RC3
Code analyzed:
109629 lines of code analyzed, in 2044 classes, in 68 packages.
| Metric | Total | Density* |
|---|---|---|
| High Priority Warnings | 4 | 0.04 |
| Medium Priority Warnings | 20 | 0.18 |
| Total Warnings | 24 | 0.22 |
(* Defects per Thousand lines of non-commenting source statements)
| Warning Type | Number |
|---|---|
| Bad practice Warnings | 3 |
| Correctness Warnings | 7 |
| Multithreaded correctness Warnings | 4 |
| Performance Warnings | 2 |
| Dodgy code Warnings | 8 |
| Total | 24 |
Click on a warning row to see full context information.
| Code | Warning |
|---|---|
| Eq | org.apache.hadoop.hbase.regionserver.MemStoreFlusher$WakeupFlushThread defines compareTo(Object) and uses Object.equals() |
| NP | org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.preCheckAndDeleteAfterRowLock(byte[], byte[], byte[], CompareOperator, ByteArrayComparable, Delete) has Boolean return type and returns explicit null |
| NP | org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.preCheckAndPutAfterRowLock(byte[], byte[], byte[], CompareOperator, ByteArrayComparable, Put) has Boolean return type and returns explicit null |
| Code | Warning |
|---|---|
| NP | bestAnyRegion could be null and is guaranteed to be dereferenced in org.apache.hadoop.hbase.regionserver.MemStoreFlusher.flushOneForGlobalPressure() |
| NP | Possible null pointer dereference of nextWriter in org.apache.hadoop.hbase.regionserver.wal.AsyncFSWAL.doReplaceWriter(Path, Path, WALProvider$AsyncWriter) |
| NP | Possible null pointer dereference of commandLine in org.apache.hadoop.hbase.util.compaction.MajorCompactor.main(String[]) on exception path |
| RCN | Nullcheck of parentHRI at line 442 of value previously dereferenced in org.apache.hadoop.hbase.master.assignment.SplitTableRegionProcedure.prepareSplitRegion(MasterProcedureEnv) |
| RCN | Nullcheck of bestFlushableRegion at line 172 of value previously dereferenced in org.apache.hadoop.hbase.regionserver.MemStoreFlusher.flushOneForGlobalPressure() |
| RCN | Nullcheck of bestRegionReplica at line 214 of value previously dereferenced in org.apache.hadoop.hbase.regionserver.MemStoreFlusher.flushOneForGlobalPressure() |
| RCN | Nullcheck of regionToFlush at line 172 of value previously dereferenced in org.apache.hadoop.hbase.regionserver.MemStoreFlusher.flushOneForGlobalPressure() |
| Code | Warning |
|---|---|
| IS | Inconsistent synchronization of org.apache.hadoop.hbase.ipc.RpcServer.authManager; locked 50% of time |
| IS | Inconsistent synchronization of org.apache.hadoop.hbase.master.ClusterStatusPublisher.connected; locked 50% of time |
| IS | Inconsistent synchronization of org.apache.hadoop.hbase.master.replication.RefreshPeerProcedure.targetServer; locked 57% of time |
| LI | Incorrect lazy initialization of static field org.apache.hadoop.hbase.replication.regionserver.ReplicationSyncUp.conf in org.apache.hadoop.hbase.replication.regionserver.ReplicationSyncUp.main(String[]) |
| Code | Warning |
|---|---|
| Bx | Boxing/unboxing to parse a primitive org.apache.hadoop.hbase.master.cleaner.CleanerChore.calculatePoolSize(String) |
| Bx | Boxing/unboxing to parse a primitive org.apache.hadoop.hbase.util.compaction.MajorCompactor.main(String[]) |
| Code | Warning |
|---|---|
| DB | org.apache.hadoop.hbase.regionserver.CompactingMemStore.initInmemoryFlushSize(Configuration) uses the same code for two branches |
| DLS | Dead store to startTime in org.apache.hadoop.hbase.master.assignment.AssignmentManager.processofflineServersWithOnlineRegions() |
| DLS | Dead store to hostname in new org.apache.hadoop.hbase.regionserver.RSRpcServices(HRegionServer, RSRpcServices$LogDelegate) |
| SF | Switch statement found in org.apache.hadoop.hbase.regionserver.HRegion.startRegionOperation(Region$Operation) where default case is missing |
| ST | Write to static field org.apache.hadoop.hbase.master.cleaner.CleanerChore.chorePool from instance method new org.apache.hadoop.hbase.master.cleaner.CleanerChore(String, int, Stoppable, Configuration, FileSystem, Path, String, Map) |
| ST | Write to static field org.apache.hadoop.hbase.master.cleaner.CleanerChore.chorePoolSize from instance method new org.apache.hadoop.hbase.master.cleaner.CleanerChore(String, int, Stoppable, Configuration, FileSystem, Path, String, Map) |
| ST | Write to static field org.apache.hadoop.hbase.master.cleaner.CleanerChore.chorePoolSize from instance method org.apache.hadoop.hbase.master.cleaner.CleanerChore.onConfigurationChange(Configuration) |
| UC | Useless object stored in variable toStartup of method org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceManager.refreshSources(String) |
A boxed primitive is created from a String, just to extract the unboxed primitive value. It is more efficient to just call the static parseXXX method.
This method uses the same code to implement two branches of a conditional branch. Check to ensure that this isn't a coding mistake.
This instruction assigns a value to a local variable, but the value is not read or used in any subsequent instruction. Often, this indicates an error, because the value computed is never used.
Note that Sun's javac compiler often generates dead stores for final local variables. Because FindBugs is a bytecode-based tool, there is no easy way to eliminate these false positives.
This class defines a compareTo(...) method but inherits its
equals() method from java.lang.Object.
Generally, the value of compareTo should return zero if and only if
equals returns true. If this is violated, weird and unpredictable
failures will occur in classes such as PriorityQueue.
In Java 5 the PriorityQueue.remove method uses the compareTo method,
while in Java 6 it uses the equals method.
From the JavaDoc for the compareTo method in the Comparable interface:
It is strongly recommended, but not strictly required that (x.compareTo(y)==0) == (x.equals(y)).
Generally speaking, any class that implements the Comparable interface and violates this condition
should clearly indicate this fact. The recommended language
is "Note: this class has a natural ordering that is inconsistent with equals."
The fields of this class appear to be accessed inconsistently with respect to synchronization. This bug report indicates that the bug pattern detector judged that
A typical bug matching this bug pattern is forgetting to synchronize one of the methods in a class that is intended to be thread-safe.
You can select the nodes labeled "Unsynchronized access" to show the code locations where the detector believed that a field was accessed without synchronization.
Note that there are various sources of inaccuracy in this detector; for example, the detector cannot statically detect all situations in which a lock is held. Also, even when the detector is accurate in distinguishing locked vs. unlocked accesses, the code in question may still be correct.
This method contains an unsynchronized lazy initialization of a non-volatile static field. Because the compiler or processor may reorder instructions, threads are not guaranteed to see a completely initialized object, if the method can be called by multiple threads. You can make the field volatile to correct the problem. For more information, see the Java Memory Model web site.
A method that returns either Boolean.TRUE, Boolean.FALSE or null is an accident waiting to happen. This method can be invoked as though it returned a value of type boolean, and the compiler will insert automatic unboxing of the Boolean value. If a null value is returned, this will result in a NullPointerException.
There is a statement or branch that if executed guarantees that a value is null at this point, and that value that is guaranteed to be dereferenced (except on forward paths involving runtime exceptions).
Note that a check such as
if (x == null) throw new NullPointerException();
is treated as a dereference of x.
There is a branch of statement that, if executed, guarantees that
a null value will be dereferenced, which
would generate a NullPointerException when the code is executed.
Of course, the problem might be that the branch or statement is infeasible and that
the null pointer exception can't ever be executed; deciding that is beyond the ability of FindBugs.
A reference value which is null on some exception control path is
dereferenced here. This may lead to a NullPointerException
when the code is executed.
Note that because FindBugs currently does not prune infeasible exception paths,
this may be a false warning.
Also note that FindBugs considers the default case of a switch statement to be an exception path, since the default case is often infeasible.
A value is checked here to see whether it is null, but this value can't be null because it was previously dereferenced and if it were null a null pointer exception would have occurred at the earlier dereference. Essentially, this code and the previous dereference disagree as to whether this value is allowed to be null. Either the check is redundant or the previous dereference is erroneous.
This method contains a switch statement where default case is missing. Usually you need to provide a default case.
Because the analysis only looks at the generated bytecode, this warning can be incorrect triggered if the default case is at the end of the switch statement and the switch statement doesn't contain break statements for other cases.
This instance method writes to a static field. This is tricky to get correct if multiple instances are being manipulated, and generally bad practice.
Our analysis shows that this object is useless. It's created and modified, but its value never go outside of the method or produce any side-effect. Either there is a mistake and object was intended to be used or it can be removed.
This analysis rarely produces false-positives. Common false-positive cases include:
- This object used to implicitly throw some obscure exception.
- This object used as a stub to generalize the code.
- This object used to hold strong references to weak/soft-referenced objects.