You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Santiago García Pimentel <sa...@netcentric.biz> on 2015/03/24 17:31:03 UTC

sling mocks, null pointer exception when checking the resource type of the root node

Hello,

I recently created SLING-4500 because of a bug in sling mocks, when 
using the default resource resolver in sling mocks, the root node does 
not have any jcr:primary type, this causes a NPE in some cases, for 
example, if you use resource.isResourceType() for the root node.

This happens because if there is no resourceType, it will fallback to 
the primaryType, but since there is no primary type for the root node, a 
NPE is generated.

I already suggested a small fix for this in 
https://github.com/apache/sling/pull/72 . Could this be integrated?

Thank you
-- 
*Santiago García Pimentel* | Software Engineer
Netcentric Ibérica SL
Av. Diagonal 123 -8ª
08005 Barcelona
España
Skype: santiago.garciapimentel
santiago.pimentel@netcentric.biz | www.netcentric.es

Re: sling mocks, null pointer exception when checking the resource type of the root node

Posted by Robert Munteanu <ro...@lmn.ro>.
Hi,

On Mon, Mar 30, 2015 at 12:17 PM, Santiago García Pimentel
<sa...@netcentric.biz> wrote:
> On 27/03/15 15:29, Robert Munteanu wrote:
>>
>> PR looks good to me, I added a comment related to a minor issue.
>
> Thanks Robert,
>
> I've changed the root type from jcr:root to rep:root.
>
> Greetings.

Patch applied, thank you!

Robert

>
>
> --
> *Santiago García Pimentel* | Software Engineer
> Netcentric Ibérica SL
> Av. Diagonal 123 -8ª
> 08005 Barcelona
> España
> Skype: santiago.garciapimentel
> santiago.pimentel@netcentric.biz | www.netcentric.es



-- 
Sent from my (old) computer

Re: sling mocks, null pointer exception when checking the resource type of the root node

Posted by Santiago García Pimentel <sa...@netcentric.biz>.
On 27/03/15 15:29, Robert Munteanu wrote:
> PR looks good to me, I added a comment related to a minor issue.
Thanks Robert,

I've changed the root type from jcr:root to rep:root.

Greetings.

-- 
*Santiago García Pimentel* | Software Engineer
Netcentric Ibérica SL
Av. Diagonal 123 -8ª
08005 Barcelona
España
Skype: santiago.garciapimentel
santiago.pimentel@netcentric.biz | www.netcentric.es

Re: sling mocks, null pointer exception when checking the resource type of the root node

Posted by Robert Munteanu <ro...@lmn.ro>.
Hi Santiago,

On Tue, Mar 24, 2015 at 6:31 PM, Santiago García Pimentel
<sa...@netcentric.biz> wrote:
> Hello,
>
> I recently created SLING-4500 because of a bug in sling mocks, when using
> the default resource resolver in sling mocks, the root node does not have
> any jcr:primary type, this causes a NPE in some cases, for example, if you
> use resource.isResourceType() for the root node.
>
> This happens because if there is no resourceType, it will fallback to the
> primaryType, but since there is no primary type for the root node, a NPE is
> generated.
>
> I already suggested a small fix for this in
> https://github.com/apache/sling/pull/72 . Could this be integrated?

PR looks good to me, I added a comment related to a minor issue.

Thanks,

Robert

>
> Thank you
> --
> *Santiago García Pimentel* | Software Engineer
> Netcentric Ibérica SL
> Av. Diagonal 123 -8ª
> 08005 Barcelona
> España
> Skype: santiago.garciapimentel
> santiago.pimentel@netcentric.biz | www.netcentric.es



-- 
Sent from my (old) computer