jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Bocanegra <tri...@adobe.com>
Subject Re: Session Question
Date Wed, 08 Jun 2011 07:05:14 GMT
hi,
i tested it with jackrabbit 2.2.5 and 2.2.6 and i always get 'true', 'true'.

but with this test case:

    @Test
    public void addTest() throws RepositoryException {
        TransientRepository repo = new TransientRepository();
        System.out.println("Version: " +
repo.getDescriptor(Repository.REP_VERSION_DESC));
        Session session = repo.login();
        String path = "/test";
        if (session.itemExists(path)) {
            System.out.println("removing item at " + path);
            session.removeItem(path);
        }
        Node node = session.getRootNode().addNode("test");
        System.out.println(session.itemExists(path));
        node.getPath();
        System.out.println(session.itemExists(path));
    }

regards, toby

On Tue, Jun 7, 2011 at 2:37 AM, Thomas Auinger <aui@byteconsult.de> wrote:
> A very basic problem has just come up (Jackrabbit 2.2.5). It seems that session.itemExists()
returns true for a newly created Node only after node.getPath() has been called.?!
>
> Here is the code:
>
>                Session session = prompt.getSession();
>                String path = "/test";
>                if (session.itemExists(path)) {
>                        System.out.println("removing item at " + path);
>                        session.removeItem(path);
>                }
>                Node node = session.getRootNode().addNode("test");
>                System.out.println(session.itemExists(path));
>                node.getPath();
>                System.out.println(session.itemExists(path));
>
> And the output is
>
> removing item at /test
> false
> true
>
> Does that make any sense at all? I know that I can get it to work by calling session.save()
after the addNode() line, but since its all the same session, it seems like a bug. Yet a bug
too fundamental to really be one... :O
>
> The code runs with Spring Testing Framework, in-VM Repository, Session created via Springmodules
Bean
>
> Thanks
> Tom
>
>
>
> Behalten Sie die Zukunft von Marketing und IT im Blick. Abonnieren Sie unseren Newsletter
unter http://newsletter.byteconsult.de
>
>
Mime
View raw message