Uploaded image for project: 'Commons JXPath'
  1. Commons JXPath
  2. JXPATH-107

RCN: Nullcheck of NodePointer.parent of value previously dereferenced in PropertyOwnerPointer.setValue(Object)

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Nightly Builds
    • Fix Version/s: 1.3
    • Labels:
      None
    • Environment:

      ALL

      Description

      In class PropertyOwnerPointer, method setValue

      The code says first

      if (parent.isContainer()) ...

      then it checks for parent not being null.

      else if (parent != null) {

      If the parent could be null the first code
      would trigger a null pointer exception.

      So I think:

      now the parent happens to be never null
      but either
      1. the (parent!=null) check is unecessary
      (I don't know the exact semantics of this class)
      2. or more probably the

      {parent.isContainer()}

      block should be put inside
      the

      {parent!=null}

      check.

      An other findbugs find.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              vivodamichele@hotmail.com Michele Vivoda
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: