jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dürig <mdue...@apache.org>
Subject Re: Exceptions used in oak-core
Date Thu, 22 Mar 2012 10:04:51 GMT


Here's my take at this: I'd use exceptions as sparingly as possible and 
only for cases where something unexpected (an exception!) happens. That 
is, I wouldn't use exceptions e.g. for items not being found. This is 
clearly something that happens all the time and is by no means unexpected.

For the cases where exceptions are involved I would define our own very 
small set of exceptions and make them all *unchecked*. Checked 
exceptions compose very badly wrt. lazyness. For example an iterator 
which lazily fetches its items on next() has no clean way of handling 
exceptions in the next() method.

Only at the very last instance (i.e. in the jcr component) I would 
actually create and throw the various RepositoryExceptions.


On 22.3.12 9:48, Angela Schreiber wrote:
> hi
> i would like to discuss the nature of exceptions that will
> be thrown from the oak-api/spi module.
> to illustrate:
> we decided that quite some core functionality of the JCR
> API will effectively be executed and validated on the oak-core-layer
> such as for example authentication, authorization or the complete
> versioning API. these validation needs to comply to the API contract
> defined by JSR 283/333, which define comprehensive lists of reasons
> for failure and the corresponding exceptions.
> what was your preference when it comes to those exceptions? should
> oak-core define it own set of exceptions that then would need to
> be converted to javax.jcr.*Exception in oak-jcr or should oak-core
> throw JCR exceptions?
> regards
> angela

View raw message