jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Guggisberg <stefan.guggisb...@gmail.com>
Subject Re: Session.refresh(true) behaviour
Date Fri, 19 Aug 2011 13:54:02 GMT
On Thu, Aug 18, 2011 at 1:16 PM, David Buchmann <david.buchmann@liip.ch> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> hi,
>
> the documentation [1] [2] is not very explicit how conflicts should be
> resolved. i wrote some simple test code, see below. is it correct that
> whenever i delete something on the server or move it somewhere else, the
> refresh(true) still changes the modified node to be deleted?
>
>
> Session s = repository.login(sc,workspace);
> Node n = s.getNode("/test");
> Node n2 = n.addNode("childname", "nt:folder");
> s.save();
>
> // delete the node in a separate session
> Session s2 = repository.login(sc,workspace);
> s2.removeItem("/test/childname");
> // or just s2.move("/test/childname", "/xy");
> s2.save();
>
> // add a child to the node in the first session
> Node n3 = n2.addNode("deepchild");

jackrabbit (core) fails here with an InvalidItemStateException ("Item
does not exist anymore").
that's IMO legitimate and spec-compliant behavior.

cheers
stefan


>
> // keep local changes
> s.refresh(true);
> // but our local change "create a node" is lost
> System.out.println(n3.getPath());
>
>
> cheers,david
>
> [1] http://www.day.com/specs/jcr/2.0/10_Writing.html#10.11.1%20Refresh
> [2]
> http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/Session.html#refresh(boolean)
> - --
> Liip AG // Agile Web Development // T +41 26 422 25 11
> CH-1700 Fribourg // PGP 0xA581808B // www.liip.ch
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk5M9H0ACgkQqBnXnqWBgIsZ7ACcC/5FomxChgvw7opEoxRS6LQk
> mw8AoKBwWr2Ur3iwrkov3ucX1kzSur1F
> =Q5z5
> -----END PGP SIGNATURE-----
>

Mime
View raw message