[ 
https://issues.apache.org/jira/browse/SLING-159?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12560509#action_12560509
 ] 

Felix Meschberger commented on SLING-159:
-----------------------------------------

Implemented the initially proposed workaround in Rev. 613228.

This has to be changed as soon as JCR-1328 has been resolved.

> JcrResourceResolverFactoryImpl fails if suffix contains illegal jcr character
> -----------------------------------------------------------------------------
>
>                 Key: SLING-159
>                 URL: https://issues.apache.org/jira/browse/SLING-159
>             Project: Sling
>          Issue Type: Bug
>          Components: Resource
>            Reporter: Tobias Bocanegra
>
> eg request to /content/test.html/* throws RepositoryException because the * 
> is not
> a valid jcr name character:
> javax.jcr.RepositoryException: invalid path:/content/test.html/*: 
> '/content/test.html/*' is not a valid path. '*' not a valid name character.: 
> '/content/test.html/*' is not a valid path. '*' not a valid name character.
>       at com.day.crx.core.SessionImpl.itemExists(SessionImpl.java:808)
>       at 
> org.apache.sling.jcr.api.internal.PooledSession.itemExists(PooledSession.java:235)
>       at 
> org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.itemReallyExists(JcrResourceResolverFactoryImpl.java:316)
>     ...
> Suggest to catch the exception and return false in this case:
> Index: 
> src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java
> ===================================================================
> --- 
> src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java
>     (revision 612138)
> +++ 
> src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java
>     (working copy)
> @@ -313,7 +313,11 @@
>          // assume this session has more access rights than the client Session
>          String workSpace = clientSession.getWorkspace().getName();
>          Session adminSession = getAdminSession(workSpace);
> -        return adminSession.itemExists(path);
> +        try {
> +            return adminSession.itemExists(path);
> +        } catch (RepositoryException e) {
> +            return false;
> +        }
>      }
> (another solution would be to explicitly check the path for illegal 
> characters prior to call itemExists. this way it can be distinguished from 
> other repository exceptions.)

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

Reply via email to