You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2013/02/27 11:59:12 UTC

[jira] [Comment Edited] (OAK-658) Unexpected illegal path handling on oak-jcr

    [ https://issues.apache.org/jira/browse/OAK-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13588207#comment-13588207 ] 

Jukka Zitting edited comment on OAK-658 at 2/27/13 10:58 AM:
-------------------------------------------------------------

As discussed in OAK-563, my preference for such cases is still to throw a {{PathNotFoundException}} instead of an {{IllegalArgumentException}}, but I'm fine also with the latter unless it causes compatibility issues like what Alex is suggesting.

Either way the current patch isn't a good way to solve this. Catching RuntimeExceptions is a good idea only in a limited number of cases. Using a return value like {{null}} of a checked exception is IMHO a better alternative.
                
      was (Author: jukkaz):
    As discussed in OAK-563, my preference for such cases is still to throw a {{PathNotFoundException}} instead of an {{IllegalArgumentException}}, but I'm fine also with the latter unless it causes compatibility issues like what Alex is suggesting.

Either way the current patch isn't a good way to solve this. Catching {{RuntimeException}}s is a good idea only in a limited number of cases. Using a return value like {{null}} of a checked exception is IMHO a better alternative.
                  
> Unexpected illegal path handling on oak-jcr
> -------------------------------------------
>
>                 Key: OAK-658
>                 URL: https://issues.apache.org/jira/browse/OAK-658
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: jcr
>            Reporter: Alex Parvulescu
>            Assignee: Alex Parvulescu
>            Priority: Minor
>         Attachments: SessionDelegate.java.patch
>
>
> Given an illegal path like ' * ' oak-core throws an 
> bq. java.lang.IllegalArgumentException: Invalid path: /GetStarTest1361806728422/* 
> which may confuse clients of oak-jcr (like sling) which expect to see a RepositoryException.
> I've seen this on the sling integration test 
> bq. org.apache.sling.launchpad.webapp.integrationtest.servlets.post.PostServletCreateTest.testCreatingNodeUnderFile
> which issues a get request for /GetStarTest1361806728422/*.12.json

--
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