atom feed12 messages in org.apache.jackrabbit.oak-devRe: Exceptions used in oak-core
FromSent OnAttachments
Angela SchreiberMar 22, 2012 2:48 am 
Michael DürigMar 22, 2012 3:04 am 
Julian ReschkeMar 22, 2012 3:53 am 
Michael DürigMar 22, 2012 4:17 am 
Jukka ZittingMar 22, 2012 4:20 am 
Michael DürigMar 22, 2012 4:35 am 
Thomas MuellerMar 22, 2012 5:49 am 
Thomas MuellerMar 22, 2012 5:56 am 
Thomas MuellerMar 22, 2012 6:03 am 
Julian ReschkeMar 22, 2012 6:12 am 
Michael DürigMar 22, 2012 6:25 am 
Angela SchreiberMar 27, 2012 6:07 am 
Subject:Re: Exceptions used in oak-core
From:Julian Reschke (juli@gmx.de)
Date:Mar 22, 2012 6:12:51 am
List:org.apache.jackrabbit.oak-dev

On 2012-03-22 12:17, Michael Dürig wrote:

On 22.3.12 10:54, Julian Reschke wrote:

On 2012-03-22 11:04, Michael Dürig wrote:

Hi,

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.

I'm not a fan of the "unchecked" pattern, but I agree with not throwing at all for expected things, such as NotFound. Which reminds me of considering nullability annotations so that the contract is well-defined.

+1 for nullability annotations. We need to decide on which one to use however. There seems to be quite a bit of a discussion [1]. ...

My gut feeling is "what Findbugs 2 is using, assuming it now works again". Those IMHO should work with IntelliJ as well.

Best regards, Julian