jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Reschke <julian.resc...@gmx.de>
Subject Re: hasProperty vs getProperty
Date Fri, 20 Jul 2012 07:01:02 GMT
On 2012-07-20 00:44, Alexander Klimetschek wrote:
> On 19.07.2012, at 22:22, Julian Reschke wrote:
>> On 2012-07-19 21:47, Alexander Klimetschek wrote:
>>> On 12.06.2012, at 15:01, Julian Reschke wrote:
>>>> Is this just to avoid catching exceptions? (keep in mind that the
>>>> exception might be thrown anyway...)
>>> No, if hasProperty() returns true, you don't expect the PathNotFoundEx and don't
have to handle it for the purpose of semantics! There is no catch(PathNotFoundEx) in the code
you quote :-)
>> Except for race conditions.
> Yes, but that's a separate issue (atomic behavior). Any write operation based on that
will be a separate call anyway.
> IMHO such application-level semantics (does exist vs. does not exist) should not be handled
by exceptions. Simply because it is not what exceptions are designed for (exceptions), when
the normal application logic expects this case. try/catch for normal logic is confusing.

I agree with that, but that's how JCR works.

It probably would be good to consider getProperties(...), returning an 
Iterator, instead. Of course we first would need to optimize this in 

Best regards, Julian

View raw message