You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Felix Meschberger <fm...@gmail.com> on 2010/05/21 19:04:06 UTC

Re: svn commit: r947026 - in /sling/trunk/bundles/jcr/resource/src: main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java

Hi,

On 21.05.2010 16:34, justin@apache.org wrote:
> Author: justin
> Date: Fri May 21 14:34:52 2010
> New Revision: 947026
> 
> URL: http://svn.apache.org/viewvc?rev=947026&view=rev
> Log:
> SLING-1527 - fixing listChildren() issue by both checking for WrappedResources and removing the workspace prefix if necessary. Unit tests use SyntheticResource to excercise the last bit.
> 
> Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
> URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java?rev=947026&r1=947025&r2=947026&view=diff
> ==============================================================================
> --- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java (original)
> +++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java Fri May 21 14:34:52 2010
> +        } else if (parent instanceof ResourceWrapper) {
> +
> +            parentItemResource = (JcrItemResource) ((ResourceWrapper) parent).getResource();

This is dangerous and may result in a ClassCastException if the wrapped
resource is not a JcrItemResource.

Regards
Felix

Re: svn commit: r947026 - in /sling/trunk/bundles/jcr/resource/src: main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java

Posted by Justin Edelson <ju...@gmail.com>.
On 5/21/10 1:04 PM, Felix Meschberger wrote:
> Hi,
> 
> On 21.05.2010 16:34, justin@apache.org wrote:
>> Author: justin
>> Date: Fri May 21 14:34:52 2010
>> New Revision: 947026
>>
>> URL: http://svn.apache.org/viewvc?rev=947026&view=rev
>> Log:
>> SLING-1527 - fixing listChildren() issue by both checking for WrappedResources and removing the workspace prefix if necessary. Unit tests use SyntheticResource to excercise the last bit.
>>
>> Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
>> URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java?rev=947026&r1=947025&r2=947026&view=diff
>> ==============================================================================
>> --- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java (original)
>> +++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java Fri May 21 14:34:52 2010
>> +        } else if (parent instanceof ResourceWrapper) {
>> +
>> +            parentItemResource = (JcrItemResource) ((ResourceWrapper) parent).getResource();
> 
> This is dangerous and may result in a ClassCastException if the wrapped
> resource is not a JcrItemResource.
Yeah. I'm not sure how that got committed in that state. Just committed
the actual fix.

Justin

> 
> Regards
> Felix