Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-5897

incorrect null tests in DefaultAdminCategoryService.java

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.11.93
    • Component/s: Web UI - Admin
    • Security Level: Default (Default Security Scheme)
    • Labels:

      Description

      While researching for uses of NODE_CATEGORY_MEMBERSHIP_CHANGED_EVENT_UEI, I noticed that in opennms-webapp/src/main/java/org/opennms/web/svclayer/support/DefaultAdminCategoryService.java has two null checks that will always evaluate to true, because they are checking the wrong object.

      Inside method performNodeEdit() for both the Add and Remove actions, after getting an OnmsCategory object 'category', they test if the object 'node' is null instead of 'category'.

      Attached is a patch that adds a null check for 'node', and corrects the two 'category' null checks.

      On a side note, there do not appear to be any unit tests for DefaultAdminCategoryService.

        Attachments

          Activity

            People

            • Assignee:
              ranger Benjamin Reed
              Reporter:
              ronald.roskens@biworldwide.com Ron Roskens
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: