jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting" <jukka.zitt...@gmail.com>
Subject Re: problem
Date Thu, 21 Jun 2007 13:36:16 GMT
Hi,

On 6/21/07, siraj ahmed <siraj.ahmed@hurix.com> wrote:
> [...]
>         blogEntry = null;
>             while (queryResultNodeIterator.hasNext()) {
>                 blogEntry = queryResultNodeIterator.nextNode();
>             }
> [...]
>         return blogEntry;

Assuming getBlogEntry() calls getBlogEntryNode(), then the error could
simply be that the search you are running returns no results which
causes getBlogEntryNode() to return the default blogEntry value, i.e.
null.

I would rather use code like this:

    if (queryResultNodeIterator.hasNext()) {
        return queryResultNodeIterator.nextNode();
    } else {
        throw new BlogEntryNotFoundException();
    }

BR,

Jukka Zitting

Mime
View raw message