Description
- UomWorker.java:70, PZLA_PREFER_ZERO_LENGTH_ARRAYS
PZLA: Should org.apache.ofbiz.common.uom.UomWorker.uomTimeToCalTime(String) return a zero length array rather than null?
It is often a better design to return a length zero array rather than a null reference to indicate that there are no results (i.e., an empty list of results). This way, no explicit check for null is needed by clients of the method.
On the other hand, using null to indicate "there is no answer to this question" is probably appropriate. For example, File.listFiles() returns an empty list if given a directory containing no files, and returns null if the file is not a directory.
- UomWorker.java:107, DLS_DEAD_LOCAL_STORE
DLS: Dead store to svcOutMap in org.apache.ofbiz.common.uom.UomWorker.convertUom(BigDecimal, String, String, LocalDispatcher)
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.