Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-9450 Fixing defects reported by code analysis tools
  3. OFBIZ-9527

[FB] Packages org.apache.ofbiz.accounting.period and org.apache.ofbiz.accounting.tax

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Trunk
    • Fix Version/s: Upcoming Release
    • Component/s: accounting
    • Labels:
      None
    • Flags:
      Patch

      Description

      PeriodServices.java:42, MS_SHOULD_BE_FINAL

      • MS: org.apache.ofbiz.accounting.period.PeriodServices.module isn't final but should be
        This static field public but not final, and could be changed by malicious code or by accident from another package. The field could be made final to avoid this vulnerability.

      After adjusting the FindBugs configuration, a new bug has been found in TaxAuthorityServices:

      TaxAuthorityServices.java:350, RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE

      • RCN: Redundant nullcheck of productCategoryCond, which is known to be non-null in org.apache.ofbiz.accounting.tax.TaxAuthorityServices.getTaxAdjustments(Delegator, GenericValue, GenericValue, String, String, Set, BigDecimal, BigDecimal, BigDecimal, BigDecimal, BigDecimal)
        This method contains a redundant check of a known non-null value against the constant null.

        Activity

        Hide
        Kyra Pritzel-Hentley Kyra Pritzel-Hentley added a comment -

        The patch resolves the above mentioned bugs.
        In TaxAuthorityServices every possible case sets the variable productCategoryCond, rendering it always not-null. I extracted a method for better readability of the code. The documentation of the new method explicitly states that a non-null value is returned.

        Show
        Kyra Pritzel-Hentley Kyra Pritzel-Hentley added a comment - The patch resolves the above mentioned bugs. In TaxAuthorityServices every possible case sets the variable productCategoryCond, rendering it always not-null. I extracted a method for better readability of the code. The documentation of the new method explicitly states that a non-null value is returned.
        Hide
        mbrohl Michael Brohl added a comment -

        Thanks Kyra,

        your patch is in trunk r1805466.

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

          People

          • Assignee:
            mbrohl Michael Brohl
            Reporter:
            Kyra Pritzel-Hentley Kyra Pritzel-Hentley
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development