Hi,

On 10/4/06, behrangsa <[EMAIL PROTECTED]> 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/ - [EMAIL PROTECTED]
Software craftsmanship, JCR consulting, and Java development

Reply via email to