Commons JXPath
  1. Commons JXPath
  2. JXPATH-107

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

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor 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.

        Activity

        Michele Vivoda created issue -
        Hide
        Matt Benson added a comment -

        Moved the parent Unable to render embedded object: File (= null check outward. Thanks) not found.

        Show
        Matt Benson added a comment - Moved the parent Unable to render embedded object: File (= null check outward. Thanks) not found.
        Matt Benson made changes -
        Field Original Value New Value
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.3 [ 12312253 ]
        Matt Benson made changes -
        Affects Version/s Nightly Builds [ 12311823 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Michele Vivoda
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development