You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Alexander Klimetschek (JIRA)" <ji...@apache.org> on 2008/11/05 14:23:44 UTC

[jira] Created: (JCR-1847) Path methods should throw NameEx instead of RepositoryEx

Path methods should throw NameEx instead of RepositoryEx
--------------------------------------------------------

                 Key: JCR-1847
                 URL: https://issues.apache.org/jira/browse/JCR-1847
             Project: Jackrabbit
          Issue Type: Improvement
          Components: jackrabbit-spi
            Reporter: Alexander Klimetschek
            Priority: Minor


The o.a.j.spi.Path interface declares most methods to throw a RepositoryEx, whereas a o.a.j.spi.commons.conversion.NameEx (or another specific exception) would make more sense, since the RepositoryEx is too generic for what seems to be a "malformed names/path" nature for all things that happen in a Path implementation.

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


[jira] Resolved: (JCR-1847) Path methods should throw a specific exception instead of RepositoryEx

Posted by "angela (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

angela resolved JCR-1847.
-------------------------

    Resolution: Won't Fix
      Assignee: angela

won't reach consensus on this. introducing "a helper class had its own exception" just restores the situation we had with "BaseException" and which we finally got rid of. 

resolving won't fix.

> Path methods should throw a specific exception instead of RepositoryEx
> ----------------------------------------------------------------------
>
>                 Key: JCR-1847
>                 URL: https://issues.apache.org/jira/browse/JCR-1847
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-spi
>            Reporter: Alexander Klimetschek
>            Assignee: angela
>            Priority: Minor
>
> The o.a.j.spi.Path interface declares most methods to throw a RepositoryEx, whereas a o.a.j.spi.commons.conversion.NameEx (or another specific exception) would make more sense, since the RepositoryEx is too generic for what seems to be a "malformed names/path" nature for all things that happen in a Path implementation.

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


[jira] Commented: (JCR-1847) Path methods should throw a specific exception instead of RepositoryEx

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12674559#action_12674559 ] 

Stefan Guggisberg commented on JCR-1847:
----------------------------------------

> the base exception was used solely inside jackrabbit-core just exactly to deal with invalid (malformed) path, unknown names, invalid names, item-state exceptions etc. and it was caught again within jackrabbit-core and rethrown as RepositoryException (in very exceptional cases a subclass of it) all over the place.

FWIW: 
the original (i.e. my;) idea behind BaseException was that it allows to clearly distinguish/detect internal exceptions from api exceptions (i.e. RepositiryExcception). exceptions thrown by internal code might not always be correct /useful in the context of an JCR api method. by using a separate base class for internal exceptions prevents potentially incorrect/meaningless internal exceptions being thrown by public JCR api methods.

just as a background information,  i don't wanna warm up previous discussions...




> Path methods should throw a specific exception instead of RepositoryEx
> ----------------------------------------------------------------------
>
>                 Key: JCR-1847
>                 URL: https://issues.apache.org/jira/browse/JCR-1847
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-spi
>            Reporter: Alexander Klimetschek
>            Assignee: angela
>            Priority: Minor
>
> The o.a.j.spi.Path interface declares most methods to throw a RepositoryEx, whereas a o.a.j.spi.commons.conversion.NameEx (or another specific exception) would make more sense, since the RepositoryEx is too generic for what seems to be a "malformed names/path" nature for all things that happen in a Path implementation.

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


[jira] Resolved: (JCR-1847) Path methods should throw NameEx instead of RepositoryEx

Posted by "angela (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

angela resolved JCR-1847.
-------------------------

    Resolution: Invalid

> The o.a.j.spi.Path interface declares most methods to throw a RepositoryEx, 
> whereas a o.a.j.spi.commons.conversion.NameEx (or another specific exception) would 
> make more sense 

no... the SPI interfaces must not have a dependency to spi.commons.


> Path methods should throw NameEx instead of RepositoryEx
> --------------------------------------------------------
>
>                 Key: JCR-1847
>                 URL: https://issues.apache.org/jira/browse/JCR-1847
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-spi
>            Reporter: Alexander Klimetschek
>            Priority: Minor
>
> The o.a.j.spi.Path interface declares most methods to throw a RepositoryEx, whereas a o.a.j.spi.commons.conversion.NameEx (or another specific exception) would make more sense, since the RepositoryEx is too generic for what seems to be a "malformed names/path" nature for all things that happen in a Path implementation.

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


[jira] Commented: (JCR-1847) Path methods should throw a specific exception instead of RepositoryEx

Posted by "angela (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645222#action_12645222 ] 

angela commented on JCR-1847:
-----------------------------

basically i am not in favor of inventing additional repository exceptions within the scope of the SPI.
see also JCR-1328 for discussion on more detailed exceptions with jsr 283.

> Path methods should throw a specific exception instead of RepositoryEx
> ----------------------------------------------------------------------
>
>                 Key: JCR-1847
>                 URL: https://issues.apache.org/jira/browse/JCR-1847
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-spi
>            Reporter: Alexander Klimetschek
>            Priority: Minor
>
> The o.a.j.spi.Path interface declares most methods to throw a RepositoryEx, whereas a o.a.j.spi.commons.conversion.NameEx (or another specific exception) would make more sense, since the RepositoryEx is too generic for what seems to be a "malformed names/path" nature for all things that happen in a Path implementation.

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


[jira] Commented: (JCR-1847) Path methods should throw a specific exception instead of RepositoryEx

Posted by "angela (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12674501#action_12674501 ] 

angela commented on JCR-1847:
-----------------------------

> AFAIK BaseException was used for everything in commons, so it has not the same semantics 
> as a (new) "InvalidPathException".

the base exception was used solely inside jackrabbit-core just exactly to deal with invalid (malformed) path, unknown names, invalid names, item-state exceptions etc. and it was caught again within jackrabbit-core and rethrown as RepositoryException (in very exceptional cases a subclass of it) all over the place.


> Path methods should throw a specific exception instead of RepositoryEx
> ----------------------------------------------------------------------
>
>                 Key: JCR-1847
>                 URL: https://issues.apache.org/jira/browse/JCR-1847
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-spi
>            Reporter: Alexander Klimetschek
>            Assignee: angela
>            Priority: Minor
>
> The o.a.j.spi.Path interface declares most methods to throw a RepositoryEx, whereas a o.a.j.spi.commons.conversion.NameEx (or another specific exception) would make more sense, since the RepositoryEx is too generic for what seems to be a "malformed names/path" nature for all things that happen in a Path implementation.

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


[jira] Commented: (JCR-1847) Path methods should throw a specific exception instead of RepositoryEx

Posted by "angela (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645232#action_12645232 ] 

angela commented on JCR-1847:
-----------------------------

> AFAIK it does not have to inherit RepositoryException in any way.

that's what we had before.... resulting in

} catch (WhatEverNameException wene) {
     throw new RepositoryException();
}

and i wouldn't want to go back to that state.

> Path methods should throw a specific exception instead of RepositoryEx
> ----------------------------------------------------------------------
>
>                 Key: JCR-1847
>                 URL: https://issues.apache.org/jira/browse/JCR-1847
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-spi
>            Reporter: Alexander Klimetschek
>            Priority: Minor
>
> The o.a.j.spi.Path interface declares most methods to throw a RepositoryEx, whereas a o.a.j.spi.commons.conversion.NameEx (or another specific exception) would make more sense, since the RepositoryEx is too generic for what seems to be a "malformed names/path" nature for all things that happen in a Path implementation.

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


[jira] Commented: (JCR-1847) Path methods should throw a specific exception instead of RepositoryEx

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12674340#action_12674340 ] 

Alexander Klimetschek commented on JCR-1847:
--------------------------------------------

> introducing "a helper class had its own exception" just restores the situation we had with "BaseException" and which we finally got rid of.

AFAIK BaseException was used for everything in commons, so it has not the same semantics as a (new) "InvalidPathException".

But the longer I look at it, the real issue is that internal code uses the spi Path interface for path related utilites - which seems not right to me - especially if there is no specific exception for a malformed path, what I would consider as a missing feature of that utility API.

> Path methods should throw a specific exception instead of RepositoryEx
> ----------------------------------------------------------------------
>
>                 Key: JCR-1847
>                 URL: https://issues.apache.org/jira/browse/JCR-1847
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-spi
>            Reporter: Alexander Klimetschek
>            Assignee: angela
>            Priority: Minor
>
> The o.a.j.spi.Path interface declares most methods to throw a RepositoryEx, whereas a o.a.j.spi.commons.conversion.NameEx (or another specific exception) would make more sense, since the RepositoryEx is too generic for what seems to be a "malformed names/path" nature for all things that happen in a Path implementation.

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


[jira] Commented: (JCR-1847) Path methods should throw a specific exception instead of RepositoryEx

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12674259#action_12674259 ] 

Thomas Mueller commented on JCR-1847:
-------------------------------------

I think just RepositoryException with an error codes would be better, as in JDBC (example: http://www.h2database.com/javadoc/org/h2/constant/ErrorCode.html ). Unfortunately RepositoryException doesn't have an error code. Specific exception just bloats everything (methods tend to end with "throws a, b, c, d,...", and there are many catch/throw cases). The JCR 1.0 API already has 18 exception types, which seems like far too many in my view.

Even more radical: only use unchecked exceptions (RepositoryException extends RuntimeException). So you don't have to catch / re-throw. Most modern languages (for example Scala) don't have checked exceptions any more.

> Path methods should throw a specific exception instead of RepositoryEx
> ----------------------------------------------------------------------
>
>                 Key: JCR-1847
>                 URL: https://issues.apache.org/jira/browse/JCR-1847
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-spi
>            Reporter: Alexander Klimetschek
>            Assignee: angela
>            Priority: Minor
>
> The o.a.j.spi.Path interface declares most methods to throw a RepositoryEx, whereas a o.a.j.spi.commons.conversion.NameEx (or another specific exception) would make more sense, since the RepositoryEx is too generic for what seems to be a "malformed names/path" nature for all things that happen in a Path implementation.

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


[jira] Commented: (JCR-1847) Path methods should throw a specific exception instead of RepositoryEx

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645236#action_12645236 ] 

Alexander Klimetschek commented on JCR-1847:
--------------------------------------------

> that's what we had before.... resulting in
> 
> } catch (WhatEverNameException wene) {
>      throw new RepositoryException();
> }

You have that anyway, since other path related utility methods throw specific exceptions (NameEx, IllegalNameEx, etc.), see the example ObservationManagerImpl. It would be more consistent if such a helper class had its own exception - RepositoryEx is only the wrapper for everything that could fail, it's not better than simply using Exception. And when I see RepositoryEx I think of unforseeable cases such as network broken... which is what i originally should only represent. But that is a (minor) problem with the JCR spec ;-)


> Path methods should throw a specific exception instead of RepositoryEx
> ----------------------------------------------------------------------
>
>                 Key: JCR-1847
>                 URL: https://issues.apache.org/jira/browse/JCR-1847
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-spi
>            Reporter: Alexander Klimetschek
>            Priority: Minor
>
> The o.a.j.spi.Path interface declares most methods to throw a RepositoryEx, whereas a o.a.j.spi.commons.conversion.NameEx (or another specific exception) would make more sense, since the RepositoryEx is too generic for what seems to be a "malformed names/path" nature for all things that happen in a Path implementation.

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


[jira] Reopened: (JCR-1847) Path methods should throw NameEx instead of RepositoryEx

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Klimetschek reopened JCR-1847:
----------------------------------------


Ok, that's why a noted to maybe use another specific exception. That one would have to be created in spi then.

Or turn it around and not use the spi interfaces as utility methods in internal code (such as the mentioned ObservationManagerImpl, where the Path interface is used for parsing + checking path strings passed in the normal JCR API.

> Path methods should throw NameEx instead of RepositoryEx
> --------------------------------------------------------
>
>                 Key: JCR-1847
>                 URL: https://issues.apache.org/jira/browse/JCR-1847
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-spi
>            Reporter: Alexander Klimetschek
>            Priority: Minor
>
> The o.a.j.spi.Path interface declares most methods to throw a RepositoryEx, whereas a o.a.j.spi.commons.conversion.NameEx (or another specific exception) would make more sense, since the RepositoryEx is too generic for what seems to be a "malformed names/path" nature for all things that happen in a Path implementation.

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


[jira] Commented: (JCR-1847) Path methods should throw a specific exception instead of RepositoryEx

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645229#action_12645229 ] 

Alexander Klimetschek commented on JCR-1847:
--------------------------------------------

AFAIK it does not have to inherit RepositoryException in any way. I don't like too much exceptions either; isn't there a generic (java sdk) exception for a "malformed path/url" problem?

> Path methods should throw a specific exception instead of RepositoryEx
> ----------------------------------------------------------------------
>
>                 Key: JCR-1847
>                 URL: https://issues.apache.org/jira/browse/JCR-1847
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-spi
>            Reporter: Alexander Klimetschek
>            Priority: Minor
>
> The o.a.j.spi.Path interface declares most methods to throw a RepositoryEx, whereas a o.a.j.spi.commons.conversion.NameEx (or another specific exception) would make more sense, since the RepositoryEx is too generic for what seems to be a "malformed names/path" nature for all things that happen in a Path implementation.

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


[jira] Updated: (JCR-1847) Path methods should throw a specific exception instead of RepositoryEx

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Klimetschek updated JCR-1847:
---------------------------------------

    Summary: Path methods should throw a specific exception instead of RepositoryEx  (was: Path methods should throw NameEx instead of RepositoryEx)

(also removing the NameEx from the title)

> Path methods should throw a specific exception instead of RepositoryEx
> ----------------------------------------------------------------------
>
>                 Key: JCR-1847
>                 URL: https://issues.apache.org/jira/browse/JCR-1847
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-spi
>            Reporter: Alexander Klimetschek
>            Priority: Minor
>
> The o.a.j.spi.Path interface declares most methods to throw a RepositoryEx, whereas a o.a.j.spi.commons.conversion.NameEx (or another specific exception) would make more sense, since the RepositoryEx is too generic for what seems to be a "malformed names/path" nature for all things that happen in a Path implementation.

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


[jira] Issue Comment Edited: (JCR-1847) Path methods should throw NameEx instead of RepositoryEx

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645220#action_12645220 ] 

alexander.klimetschek edited comment on JCR-1847 at 11/5/08 5:59 AM:
---------------------------------------------------------------------

Ok, that's why I noted to maybe use another specific exception. That one would have to be created in spi then.

Or turn it around and not use the spi interfaces as utility methods in internal code (such as the mentioned ObservationManagerImpl, where the Path interface is used for parsing + checking path strings passed in the normal JCR API), but create another Path utility interface for that.

      was (Author: alexander.klimetschek):
    Ok, that's why a noted to maybe use another specific exception. That one would have to be created in spi then.

Or turn it around and not use the spi interfaces as utility methods in internal code (such as the mentioned ObservationManagerImpl, where the Path interface is used for parsing + checking path strings passed in the normal JCR API.
  
> Path methods should throw NameEx instead of RepositoryEx
> --------------------------------------------------------
>
>                 Key: JCR-1847
>                 URL: https://issues.apache.org/jira/browse/JCR-1847
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-spi
>            Reporter: Alexander Klimetschek
>            Priority: Minor
>
> The o.a.j.spi.Path interface declares most methods to throw a RepositoryEx, whereas a o.a.j.spi.commons.conversion.NameEx (or another specific exception) would make more sense, since the RepositoryEx is too generic for what seems to be a "malformed names/path" nature for all things that happen in a Path implementation.

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


[jira] Commented: (JCR-1847) Path methods should throw NameEx instead of RepositoryEx

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645214#action_12645214 ] 

Alexander Klimetschek commented on JCR-1847:
--------------------------------------------

An example usage of path.getNormalizedPath() that would be improved (ie. more concise exception handling) is o.a.j.core.observation.ObservationManagerImpl.addEventListener.

> Path methods should throw NameEx instead of RepositoryEx
> --------------------------------------------------------
>
>                 Key: JCR-1847
>                 URL: https://issues.apache.org/jira/browse/JCR-1847
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-spi
>            Reporter: Alexander Klimetschek
>            Priority: Minor
>
> The o.a.j.spi.Path interface declares most methods to throw a RepositoryEx, whereas a o.a.j.spi.commons.conversion.NameEx (or another specific exception) would make more sense, since the RepositoryEx is too generic for what seems to be a "malformed names/path" nature for all things that happen in a Path implementation.

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