You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "André Bierwolf (JIRA)" <ji...@apache.org> on 2007/08/07 09:37:59 UTC

[jira] Created: (JCR-1053) Calling size method of a ManageableArrayList causes NullPointerException

Calling size method of a ManageableArrayList causes NullPointerException
------------------------------------------------------------------------

                 Key: JCR-1053
                 URL: https://issues.apache.org/jira/browse/JCR-1053
             Project: Jackrabbit
          Issue Type: Bug
          Components: jcr-mapping
    Affects Versions: 1.3
            Reporter: André Bierwolf
         Attachments: NTCollectionConverterImpl.diff

When using the NTCollectionConverterImpl with proxy="true" a call on the size () method of a ManageableArrayList causes a NullPointerException if there is no underlying List. LazyCollectionLoader doLoad returns null because there is are no children.

The ManageableArrayList is created because the isNull method of the NTCollectionConverterImpl class always returns false. 
According to the comment line this is done because the getCollectionNodes always returns a list. 
But after the fix for JCR-882 this is not correct anymore.

The attached fix corrects this. 

The only question remaining is how to differ between an empty list and a null-value for the field containing the list.

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


[jira] Updated: (JCR-1053) Calling size method of a ManageableArrayList causes NullPointerException

Posted by "André Bierwolf (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

André Bierwolf updated JCR-1053:
--------------------------------

    Attachment: NTCollectionConverterImpl.diff

Fix for isNull method

> Calling size method of a ManageableArrayList causes NullPointerException
> ------------------------------------------------------------------------
>
>                 Key: JCR-1053
>                 URL: https://issues.apache.org/jira/browse/JCR-1053
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jcr-mapping
>    Affects Versions: 1.3
>            Reporter: André Bierwolf
>         Attachments: NTCollectionConverterImpl.diff
>
>
> When using the NTCollectionConverterImpl with proxy="true" a call on the size () method of a ManageableArrayList causes a NullPointerException if there is no underlying List. LazyCollectionLoader doLoad returns null because there is are no children.
> The ManageableArrayList is created because the isNull method of the NTCollectionConverterImpl class always returns false. 
> According to the comment line this is done because the getCollectionNodes always returns a list. 
> But after the fix for JCR-882 this is not correct anymore.
> The attached fix corrects this. 
> The only question remaining is how to differ between an empty list and a null-value for the field containing the list.

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


[jira] Resolved: (JCR-1053) Calling size method of a ManageableArrayList causes NullPointerException

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

Christophe Lombart resolved JCR-1053.
-------------------------------------

    Resolution: Fixed

Fixed. Can you check if it is ok for you ?

Right now, if there is no node matching to the collection element,  the collection is null. We can imagine to return an empty collection. I think returning a null value or an empty collection is almost the same in this case. Please, add your comment if you are not agree. Thanks

> Calling size method of a ManageableArrayList causes NullPointerException
> ------------------------------------------------------------------------
>
>                 Key: JCR-1053
>                 URL: https://issues.apache.org/jira/browse/JCR-1053
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jcr-mapping
>    Affects Versions: 1.3
>            Reporter: André Bierwolf
>            Assignee: Christophe Lombart
>         Attachments: NTCollectionConverterImpl.diff
>
>
> When using the NTCollectionConverterImpl with proxy="true" a call on the size () method of a ManageableArrayList causes a NullPointerException if there is no underlying List. LazyCollectionLoader doLoad returns null because there is are no children.
> The ManageableArrayList is created because the isNull method of the NTCollectionConverterImpl class always returns false. 
> According to the comment line this is done because the getCollectionNodes always returns a list. 
> But after the fix for JCR-882 this is not correct anymore.
> The attached fix corrects this. 
> The only question remaining is how to differ between an empty list and a null-value for the field containing the list.

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


[jira] Commented: (JCR-1053) Calling size method of a ManageableArrayList causes NullPointerException

Posted by "Christophe Lombart (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12520387 ] 

Christophe Lombart commented on JCR-1053:
-----------------------------------------

Testing on !parentNode.hasNodes() is not sufficient. We have to check if the parent node has children based on a specific type. The type use for the collection elements. It is possible to have other children (based on another nt) which are not element of the collection. 

> Calling size method of a ManageableArrayList causes NullPointerException
> ------------------------------------------------------------------------
>
>                 Key: JCR-1053
>                 URL: https://issues.apache.org/jira/browse/JCR-1053
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jcr-mapping
>    Affects Versions: 1.3
>            Reporter: André Bierwolf
>            Assignee: Christophe Lombart
>         Attachments: NTCollectionConverterImpl.diff
>
>
> When using the NTCollectionConverterImpl with proxy="true" a call on the size () method of a ManageableArrayList causes a NullPointerException if there is no underlying List. LazyCollectionLoader doLoad returns null because there is are no children.
> The ManageableArrayList is created because the isNull method of the NTCollectionConverterImpl class always returns false. 
> According to the comment line this is done because the getCollectionNodes always returns a list. 
> But after the fix for JCR-882 this is not correct anymore.
> The attached fix corrects this. 
> The only question remaining is how to differ between an empty list and a null-value for the field containing the list.

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


[jira] Commented: (JCR-1053) Calling size method of a ManageableArrayList causes NullPointerException

Posted by "André Bierwolf (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12520468 ] 

André Bierwolf commented on JCR-1053:
-------------------------------------

Thanks for fixing this issue. I agree with the solution of returning null here, because I already check for null when adding a element.
I don't initialize my collection until the first add.


> Calling size method of a ManageableArrayList causes NullPointerException
> ------------------------------------------------------------------------
>
>                 Key: JCR-1053
>                 URL: https://issues.apache.org/jira/browse/JCR-1053
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jcr-mapping
>    Affects Versions: 1.3
>            Reporter: André Bierwolf
>            Assignee: Christophe Lombart
>         Attachments: NTCollectionConverterImpl.diff
>
>
> When using the NTCollectionConverterImpl with proxy="true" a call on the size () method of a ManageableArrayList causes a NullPointerException if there is no underlying List. LazyCollectionLoader doLoad returns null because there is are no children.
> The ManageableArrayList is created because the isNull method of the NTCollectionConverterImpl class always returns false. 
> According to the comment line this is done because the getCollectionNodes always returns a list. 
> But after the fix for JCR-882 this is not correct anymore.
> The attached fix corrects this. 
> The only question remaining is how to differ between an empty list and a null-value for the field containing the list.

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


[jira] Assigned: (JCR-1053) Calling size method of a ManageableArrayList causes NullPointerException

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

Christophe Lombart reassigned JCR-1053:
---------------------------------------

    Assignee: Christophe Lombart

> Calling size method of a ManageableArrayList causes NullPointerException
> ------------------------------------------------------------------------
>
>                 Key: JCR-1053
>                 URL: https://issues.apache.org/jira/browse/JCR-1053
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jcr-mapping
>    Affects Versions: 1.3
>            Reporter: André Bierwolf
>            Assignee: Christophe Lombart
>         Attachments: NTCollectionConverterImpl.diff
>
>
> When using the NTCollectionConverterImpl with proxy="true" a call on the size () method of a ManageableArrayList causes a NullPointerException if there is no underlying List. LazyCollectionLoader doLoad returns null because there is are no children.
> The ManageableArrayList is created because the isNull method of the NTCollectionConverterImpl class always returns false. 
> According to the comment line this is done because the getCollectionNodes always returns a list. 
> But after the fix for JCR-882 this is not correct anymore.
> The attached fix corrects this. 
> The only question remaining is how to differ between an empty list and a null-value for the field containing the list.

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