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 <[EMAIL PROTECTED]> 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
>
>

Reply via email to