You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Michele Vivoda (JIRA)" <ji...@apache.org> on 2007/12/11 19:03:44 UTC

[jira] Created: (JXPATH-107) RCN: Nullcheck of NodePointer.parent of value previously dereferenced in PropertyOwnerPointer.setValue(Object)

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

                 Key: JXPATH-107
                 URL: https://issues.apache.org/jira/browse/JXPATH-107
             Project: Commons JXPath
          Issue Type: Bug
         Environment: ALL
            Reporter: Michele Vivoda
            Priority: Minor


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.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (JXPATH-107) RCN: Nullcheck of NodePointer.parent of value previously dereferenced in PropertyOwnerPointer.setValue(Object)

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JXPATH-107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Benson resolved JXPATH-107.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3

Moved the parent != null check outward.  Thanks!

> RCN: Nullcheck of NodePointer.parent of value previously dereferenced in PropertyOwnerPointer.setValue(Object)
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: JXPATH-107
>                 URL: https://issues.apache.org/jira/browse/JXPATH-107
>             Project: Commons JXPath
>          Issue Type: Bug
>    Affects Versions: Nightly Builds
>         Environment: ALL
>            Reporter: Michele Vivoda
>            Priority: Minor
>             Fix For: 1.3
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JXPATH-107) RCN: Nullcheck of NodePointer.parent of value previously dereferenced in PropertyOwnerPointer.setValue(Object)

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JXPATH-107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Benson updated JXPATH-107:
-------------------------------

    Affects Version/s: Nightly Builds

> RCN: Nullcheck of NodePointer.parent of value previously dereferenced in PropertyOwnerPointer.setValue(Object)
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: JXPATH-107
>                 URL: https://issues.apache.org/jira/browse/JXPATH-107
>             Project: Commons JXPath
>          Issue Type: Bug
>    Affects Versions: Nightly Builds
>         Environment: ALL
>            Reporter: Michele Vivoda
>            Priority: Minor
>             Fix For: 1.3
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.