Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Implemented
    • Affects Version/s: Trunk
    • Fix Version/s: Upcoming Release
    • Component/s: framework
    • Labels:
      None

      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.

        Activity

        Hide
        Dennis Balkir Dennis Balkir added a comment - - edited
        • Diamond Operators fixed
        • Line 70: changes not necessary
        • Line 107: deleted = new LinkedHashMap<>() because it is not necessary at this point
        Show
        Dennis Balkir Dennis Balkir added a comment - - edited Diamond Operators fixed Line 70: changes not necessary Line 107: deleted = new LinkedHashMap<>() because it is not necessary at this point
        Hide
        mbrohl Michael Brohl added a comment -

        Thanks Dennis,

        your patch is in trunk r1811428.

        Show
        mbrohl Michael Brohl added a comment - Thanks Dennis, your patch is in trunk r1811428.

          People

          • Assignee:
            mbrohl Michael Brohl
            Reporter:
            Dennis Balkir Dennis Balkir
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development