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 (JIRA)" <ji...@apache.org> on 2008/01/18 20:11:35 UTC

[jira] Issue Comment Edited: (SLING-159) JcrResourceResolverFactoryImpl fails if suffix contains illegal jcr character

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

fmeschbe edited comment on SLING-159 at 1/18/08 11:11 AM:
-------------------------------------------------------------------

Hmm, I have a not so good guts feeling with this solution.

It even seems that this behaviour has been codified in JSR 170 1.1 and is about to be codified in JSR-283. I reopened a respective issue for JSR-283 [1]


[1] https://jsr-283.dev.java.net/issues/show_bug.cgi?id=58


      was (Author: fmeschbe):
    -1

I do not have nothing to do with SPI and I do not want to check the path first.

To me the spec is perfectly clear: The path is malformed :-) The PathParser seems to acknowledge that by throwing a MalformedPathException ....

I will create a Jackrabbit JIRA.
  
> 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.