jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting" <jukka.zitt...@gmail.com>
Subject Re: TransientRepository bug?
Date Tue, 03 Oct 2006 23:29:13 GMT
Hi,

On 10/4/06, behrangsa <behrangsa@gmail.com> wrote:
> Compile and run the following class:
> [...]
> Now, change the value of BLOG_COUNT to 20 and rerun the class. When I do
> this, I get 20 exceptions:
>
> javax.jcr.PathNotFoundException: blog11
> [...]
> If I delete the repository directory and repository.xml and derby.log and
> rerun the program, the exceptions fade away...
>
> Could someone please confirm this bug?

You probably ran the program first with BLOG_COUNT set to 10. This
created nodes /blogs and /blogs/blogN (0 <= N < 10) and those nodes
were persisted for the next invocation of the program. Then, when you
ran the program again, the statement s.getRootNode().addNode("blogs")
created a *same-name sibling* for the /blogs node, namely /blogs[2],
after which your program created nodes /blogs[2]/blogN (0 <= N < 20).
Thus, nodes /blogs/blogN (10 <= N < 20) were never created, causing
your PathNotFoundExceptions.

You can solve the issue by
a) removing the entire repository between program runs,
b) deleting the /blogs content tree at the end of each run, or
c) checking if the nodes being created already exist (see Node.hasNode).

BR,

Jukka Zitting

-- 
Yukatan - http://yukatan.fi/ - info@yukatan.fi
Software craftsmanship, JCR consulting, and Java development

Mime
View raw message