You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Radu Cotescu (JIRA)" <ji...@apache.org> on 2012/10/21 18:44:11 UTC

[jira] [Created] (SLING-2626) NPE in ResourceResolverImpl.getResource

Radu Cotescu created SLING-2626:
-----------------------------------

             Summary: NPE in ResourceResolverImpl.getResource
                 Key: SLING-2626
                 URL: https://issues.apache.org/jira/browse/SLING-2626
             Project: Sling
          Issue Type: Bug
          Components: ResourceResolver
    Affects Versions: Resource Resolver 1.0.0
            Reporter: Radu Cotescu
             Fix For: Resource Resolver 1.0.0


The {{path}} parameter is not checked for null in either of the {{ResourceResolverImpl.getResource(String path)}} and {{ResourceResolverImpl.getResource(Resource base, String path)}}, which makes the two methods throw NPE on several lines.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (SLING-2626) NPE in ResourceResolverImpl.getResource

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13481188#comment-13481188 ] 

Felix Meschberger commented on SLING-2626:
------------------------------------------

I think it is not clearly specified what happens if the path is given as null. Looking at the JavaDoc of the getResource(Resource, String) method, though, I would assume that it is considered an error situation if the path is null. Hence I would prefer throwing an Exception instead of just returning null.

On the other hand, we could be lenient return null (as proposed) assuming a resource without a path just does not exist and we return this as such.
                
> NPE in ResourceResolverImpl.getResource
> ---------------------------------------
>
>                 Key: SLING-2626
>                 URL: https://issues.apache.org/jira/browse/SLING-2626
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: JCR Resource 2.1.0, Resource Resolver 1.0.0
>            Reporter: Radu Cotescu
>            Assignee: Carsten Ziegeler
>              Labels: patch
>             Fix For: Resource Resolver 1.0.0
>
>         Attachments: sling_rev_1400664.patch
>
>
> The path parameter is not checked for null in either of the ResourceResolverImpl.getResource(String path) and ResourceResolverImpl.getResource(Resource base, String path), which makes the two methods throw NPE on several lines.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (SLING-2626) NPE in ResourceResolverImpl.getResource

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

Carsten Ziegeler resolved SLING-2626.
-------------------------------------

    Resolution: Fixed

Thanks for your patch Radu, I've applied a slightly modified version
                
> NPE in ResourceResolverImpl.getResource
> ---------------------------------------
>
>                 Key: SLING-2626
>                 URL: https://issues.apache.org/jira/browse/SLING-2626
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: JCR Resource 2.1.0, Resource Resolver 1.0.0
>            Reporter: Radu Cotescu
>            Assignee: Carsten Ziegeler
>              Labels: patch
>             Fix For: Resource Resolver 1.0.0
>
>         Attachments: sling_rev_1400664.patch
>
>
> The path parameter is not checked for null in either of the ResourceResolverImpl.getResource(String path) and ResourceResolverImpl.getResource(Resource base, String path), which makes the two methods throw NPE on several lines.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (SLING-2626) NPE in ResourceResolverImpl.getResource

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

Radu Cotescu updated SLING-2626:
--------------------------------

    Attachment:     (was: sling_rev_1400664.patch)
    
> NPE in ResourceResolverImpl.getResource
> ---------------------------------------
>
>                 Key: SLING-2626
>                 URL: https://issues.apache.org/jira/browse/SLING-2626
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: Resource Resolver 1.0.0
>            Reporter: Radu Cotescu
>              Labels: patch
>             Fix For: Resource Resolver 1.0.0
>
>
> The path parameter is not checked for null in either of the ResourceResolverImpl.getResource(String path) and ResourceResolverImpl.getResource(Resource base, String path), which makes the two methods throw NPE on several lines.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (SLING-2626) NPE in ResourceResolverImpl.getResource

Posted by "Radu Cotescu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13481337#comment-13481337 ] 

Radu Cotescu commented on SLING-2626:
-------------------------------------

Thanks!
                
> NPE in ResourceResolverImpl.getResource
> ---------------------------------------
>
>                 Key: SLING-2626
>                 URL: https://issues.apache.org/jira/browse/SLING-2626
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: JCR Resource 2.1.0, Resource Resolver 1.0.0
>            Reporter: Radu Cotescu
>            Assignee: Carsten Ziegeler
>              Labels: patch
>             Fix For: Resource Resolver 1.0.0
>
>         Attachments: sling_rev_1400664.patch
>
>
> The path parameter is not checked for null in either of the ResourceResolverImpl.getResource(String path) and ResourceResolverImpl.getResource(Resource base, String path), which makes the two methods throw NPE on several lines.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (SLING-2626) NPE in ResourceResolverImpl.getResource

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

Carsten Ziegeler updated SLING-2626:
------------------------------------

    Affects Version/s: JCR Resource 2.1.0
    
> NPE in ResourceResolverImpl.getResource
> ---------------------------------------
>
>                 Key: SLING-2626
>                 URL: https://issues.apache.org/jira/browse/SLING-2626
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: JCR Resource 2.1.0, Resource Resolver 1.0.0
>            Reporter: Radu Cotescu
>            Assignee: Carsten Ziegeler
>              Labels: patch
>             Fix For: Resource Resolver 1.0.0
>
>         Attachments: sling_rev_1400664.patch
>
>
> The path parameter is not checked for null in either of the ResourceResolverImpl.getResource(String path) and ResourceResolverImpl.getResource(Resource base, String path), which makes the two methods throw NPE on several lines.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (SLING-2626) NPE in ResourceResolverImpl.getResource

Posted by "Antonio Sanso (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13481230#comment-13481230 ] 

Antonio Sanso commented on SLING-2626:
--------------------------------------

+1
                
> NPE in ResourceResolverImpl.getResource
> ---------------------------------------
>
>                 Key: SLING-2626
>                 URL: https://issues.apache.org/jira/browse/SLING-2626
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: JCR Resource 2.1.0, Resource Resolver 1.0.0
>            Reporter: Radu Cotescu
>            Assignee: Carsten Ziegeler
>              Labels: patch
>             Fix For: Resource Resolver 1.0.0
>
>         Attachments: sling_rev_1400664.patch
>
>
> The path parameter is not checked for null in either of the ResourceResolverImpl.getResource(String path) and ResourceResolverImpl.getResource(Resource base, String path), which makes the two methods throw NPE on several lines.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (SLING-2626) NPE in ResourceResolverImpl.getResource

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

Radu Cotescu updated SLING-2626:
--------------------------------

    Attachment: sling_rev_1400664.patch

I've created the attached patch which corrects the mentioned issues.
                
> NPE in ResourceResolverImpl.getResource
> ---------------------------------------
>
>                 Key: SLING-2626
>                 URL: https://issues.apache.org/jira/browse/SLING-2626
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: Resource Resolver 1.0.0
>            Reporter: Radu Cotescu
>              Labels: patch
>             Fix For: Resource Resolver 1.0.0
>
>         Attachments: sling_rev_1400664.patch
>
>
> The path parameter is not checked for null in either of the ResourceResolverImpl.getResource(String path) and ResourceResolverImpl.getResource(Resource base, String path), which makes the two methods throw NPE on several lines.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (SLING-2626) NPE in ResourceResolverImpl.getResource

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

Carsten Ziegeler reassigned SLING-2626:
---------------------------------------

    Assignee: Carsten Ziegeler
    
> NPE in ResourceResolverImpl.getResource
> ---------------------------------------
>
>                 Key: SLING-2626
>                 URL: https://issues.apache.org/jira/browse/SLING-2626
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: JCR Resource 2.1.0, Resource Resolver 1.0.0
>            Reporter: Radu Cotescu
>            Assignee: Carsten Ziegeler
>              Labels: patch
>             Fix For: Resource Resolver 1.0.0
>
>         Attachments: sling_rev_1400664.patch
>
>
> The path parameter is not checked for null in either of the ResourceResolverImpl.getResource(String path) and ResourceResolverImpl.getResource(Resource base, String path), which makes the two methods throw NPE on several lines.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (SLING-2626) NPE in ResourceResolverImpl.getResource

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

Radu Cotescu updated SLING-2626:
--------------------------------

    Attachment: sling_rev_1400664.patch
    
> NPE in ResourceResolverImpl.getResource
> ---------------------------------------
>
>                 Key: SLING-2626
>                 URL: https://issues.apache.org/jira/browse/SLING-2626
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: Resource Resolver 1.0.0
>            Reporter: Radu Cotescu
>              Labels: patch
>             Fix For: Resource Resolver 1.0.0
>
>         Attachments: sling_rev_1400664.patch
>
>
> The path parameter is not checked for null in either of the ResourceResolverImpl.getResource(String path) and ResourceResolverImpl.getResource(Resource base, String path), which makes the two methods throw NPE on several lines.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (SLING-2626) NPE in ResourceResolverImpl.getResource

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

Radu Cotescu updated SLING-2626:
--------------------------------

    Description: The path parameter is not checked for null in either of the ResourceResolverImpl.getResource(String path) and ResourceResolverImpl.getResource(Resource base, String path), which makes the two methods throw NPE on several lines.  (was: The {{path}} parameter is not checked for null in either of the {{ResourceResolverImpl.getResource(String path)}} and {{ResourceResolverImpl.getResource(Resource base, String path)}}, which makes the two methods throw NPE on several lines.)
    
> NPE in ResourceResolverImpl.getResource
> ---------------------------------------
>
>                 Key: SLING-2626
>                 URL: https://issues.apache.org/jira/browse/SLING-2626
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: Resource Resolver 1.0.0
>            Reporter: Radu Cotescu
>              Labels: patch
>             Fix For: Resource Resolver 1.0.0
>
>
> The path parameter is not checked for null in either of the ResourceResolverImpl.getResource(String path) and ResourceResolverImpl.getResource(Resource base, String path), which makes the two methods throw NPE on several lines.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (SLING-2626) NPE in ResourceResolverImpl.getResource

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13481181#comment-13481181 ] 

Carsten Ziegeler commented on SLING-2626:
-----------------------------------------

I agree that handling this makes more sense.
                
> NPE in ResourceResolverImpl.getResource
> ---------------------------------------
>
>                 Key: SLING-2626
>                 URL: https://issues.apache.org/jira/browse/SLING-2626
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: JCR Resource 2.1.0, Resource Resolver 1.0.0
>            Reporter: Radu Cotescu
>            Assignee: Carsten Ziegeler
>              Labels: patch
>             Fix For: Resource Resolver 1.0.0
>
>         Attachments: sling_rev_1400664.patch
>
>
> The path parameter is not checked for null in either of the ResourceResolverImpl.getResource(String path) and ResourceResolverImpl.getResource(Resource base, String path), which makes the two methods throw NPE on several lines.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (SLING-2626) NPE in ResourceResolverImpl.getResource

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13481248#comment-13481248 ] 

Felix Meschberger commented on SLING-2626:
------------------------------------------

[~radu.cotescu] While technically it is compile compatible, I think it is an API change if we introduce the NPE possibility by documenting it. Rather I was thinking of just throwing a SlingException.

On the other hand, the longer I think of it taking in mind, that the API should be easy to use, we should really just be nice and return null as you propose.
                
> NPE in ResourceResolverImpl.getResource
> ---------------------------------------
>
>                 Key: SLING-2626
>                 URL: https://issues.apache.org/jira/browse/SLING-2626
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: JCR Resource 2.1.0, Resource Resolver 1.0.0
>            Reporter: Radu Cotescu
>            Assignee: Carsten Ziegeler
>              Labels: patch
>             Fix For: Resource Resolver 1.0.0
>
>         Attachments: sling_rev_1400664.patch
>
>
> The path parameter is not checked for null in either of the ResourceResolverImpl.getResource(String path) and ResourceResolverImpl.getResource(Resource base, String path), which makes the two methods throw NPE on several lines.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (SLING-2626) NPE in ResourceResolverImpl.getResource

Posted by "Radu Cotescu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13481235#comment-13481235 ] 

Radu Cotescu commented on SLING-2626:
-------------------------------------

[~fmeschbe], there are two options here: either we specify in the JavaDoc that the two methods can throw a NPE in case the path parameter is null, or we just return null.
                
> NPE in ResourceResolverImpl.getResource
> ---------------------------------------
>
>                 Key: SLING-2626
>                 URL: https://issues.apache.org/jira/browse/SLING-2626
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: JCR Resource 2.1.0, Resource Resolver 1.0.0
>            Reporter: Radu Cotescu
>            Assignee: Carsten Ziegeler
>              Labels: patch
>             Fix For: Resource Resolver 1.0.0
>
>         Attachments: sling_rev_1400664.patch
>
>
> The path parameter is not checked for null in either of the ResourceResolverImpl.getResource(String path) and ResourceResolverImpl.getResource(Resource base, String path), which makes the two methods throw NPE on several lines.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira