You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Pankaj Gupta <pg...@fluent.com> on 2009/01/23 04:02:10 UTC

Moving multiple objects in a transaction results in invalid path

Hi,

This may be similar to JCR 993
(https://issues.apache.org/jira/browse/JCR-993).

When multiple nodes are moved in a single transaction then getPath() method
returns the old path for all nodes except one. For example if I have the
following nodes:
n1: /a
n2: /a/b
n3: /a/c
n4: /d

and I first move n2 and n3 to /d in a single transaction. Then when I obtain
a new reference to n2 and n3 after committing the transaction, one of them
will return the correct path and the other will return the old path. The
nodes are moved to the correct place though. And it seems to be a caching
issue since the paths are returned correctly if I restart Jackrabbit. 

I am using Session.move() method for moving the objects and Jackrabbit
1.4.2.

Thanks,
Pankaj

-- 
View this message in context: http://www.nabble.com/Moving-multiple-objects-in-a-transaction-results-in-invalid-path-tp21617709p21617709.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: Moving multiple objects in a transaction results in invalid path

Posted by Thomas Müller <th...@day.com>.
Hi,

I can't reproduce this problem. My test case is:

import java.io.File;

import javax.jcr.Node;
import javax.jcr.Repository;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;

import org.apache.jackrabbit.core.TransientRepository;

public class TestMultiMove {

    public static void main(String[] args) throws Exception {
        deleteDirectory(new File("repository"));
        Repository rep = new TransientRepository();
        Session session = rep.login(new SimpleCredentials("", new char[0]));
        Node root = session.getRootNode();
        Node a = root.addNode("a");
        Node b = a.addNode("b");
        Node c = a.addNode("c");
        Node d = root.addNode("d");
        session.save();
        session.move("/a/b", "/d/b");
        session.move("/a/c", "/d/c");
        session.save();
        System.out.println("a: " + a.getPath());
        System.out.println("b: " + b.getPath());
        System.out.println("c: " + c.getPath());
        System.out.println("d: " + d.getPath());
        session.logout();
    }

    static void deleteDirectory(File file) {
        if (file.isDirectory()) {
            File[] list = file.listFiles();
            for (int i = 0; i < list.length; i++) {
                deleteDirectory(list[i]);
            }
        }
        file.delete();
    }
}

Regards,
Thomas


On Fri, Jan 23, 2009 at 6:02 PM, Jukka Zitting <ju...@gmail.com> wrote:
> Hi,
>
> On Fri, Jan 23, 2009 at 5:59 PM, Pankaj Gupta <pg...@fluent.com> wrote:
>> Is this issue reproducible? If so, should I file a new JIRA or open JCR-993
>> again if you think its related to that?
>
> Can you check whether the problem still occurs in Jackrabbit 1.5.2?
>
> If yes, please file a new bug in Jira. It's better not to reopen bugs
> that have already been marked as closed for a past release.
>
> BR,
>
> Jukka Zitting
>

Re: Moving multiple objects in a transaction results in invalid path

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Fri, Jan 23, 2009 at 5:59 PM, Pankaj Gupta <pg...@fluent.com> wrote:
> Is this issue reproducible? If so, should I file a new JIRA or open JCR-993
> again if you think its related to that?

Can you check whether the problem still occurs in Jackrabbit 1.5.2?

If yes, please file a new bug in Jira. It's better not to reopen bugs
that have already been marked as closed for a past release.

BR,

Jukka Zitting

Re: Moving multiple objects in a transaction results in invalid path

Posted by Pankaj Gupta <pg...@fluent.com>.
Hi,

Is this issue reproducible? If so, should I file a new JIRA or open JCR-993
again if you think its related to that?

Thanks,
Pankaj

-- 
View this message in context: http://www.nabble.com/Moving-multiple-objects-in-a-transaction-results-in-invalid-path-tp21617709p21628427.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.