jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Mueller" <thomas.tom.muel...@gmail.com>
Subject Re: Logging of exceptions
Date Thu, 09 Aug 2007 07:44:14 GMT
Hi,

Exceptions should never be used for orinary control flow (see also
"Effective Java" page 170). My suggestion would be:

SharedItemStateManager.java,
    private boolean hasNonVirtualItemState(ItemId id) throws
ItemStateException {
...
        if (id.denotesNode()) {
            return persistMgr.exists((NodeId) id);
        } else {
            return persistMgr.exists((PropertyId) id);
        }
    }

This would be even a bigger change, but I think it would be the most
logical solution.

Thomas


On 8/9/07, Christoph Kiehl <ck@sulu3000.de> wrote:
> Christoph Kiehl wrote:
>
> > Maybe the following:
> >
> > private boolean hasNonVirtualItemState(ItemId id) {
> >      [...]
> >      } catch (ItemStateException ise) {
> >          return false;
> >      }
> >      [...]
> > }
> >
> > should be rewritten to:
> >
> > private boolean hasNonVirtualItemState(ItemId id) {
> >      [...]
> >      } catch (NoSuchItemStateException ise) {
> >          return false;
> >      } catch (ItemStateException ise) {
> >          log.error(ise.getMessage(), ise);
> >          throw new RuntimeException(ise);
> >      }
> >      [...]
> > }
>
> Well, maybe throwing a RepositoryException instead of a RuntimeException
> would be more appropriate ;)
>
> Cheers,
> Christoph
>
>

Mime
View raw message