jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sunil Dhage <sunil.dh...@coreobjects.com>
Subject RE: Unable to lock Exception.
Date Tue, 24 Nov 2009 05:54:07 GMT
Thanks Alex,

I got the issue resolved.

Actually, the problem is I am not at all passing the node type in my invokation.
All I have done is I invoked the verifyAndAddnode () like this
  Node account = verifyAndAddNode(session,candidatedocs,path,"lc:account","lc:account");
Since the last parameter will be treated as the node type and only then it will try to search
through the node definitions
in the .cnd file.  Then it could learn that the node is of type lockable and I got true for
account.isNodeType("mix:lockable");

By the way thanks for your replies to my post.

Regards,
Sunil
________________________________________
From: Alexander Klimetschek [aklimets@day.com]
Sent: Monday, November 23, 2009 11:29 PM
To: users@jackrabbit.apache.org
Subject: Re: Unable to lock Exception.

On Mon, Nov 23, 2009 at 10:06, Sunil Dhage <sunil.dhage@coreobjects.com> wrote:
>  public Node verifyAndAddNode(Session session,Node parent,String... parameters) throws
RepositoryException
>    {   Node node2Add = null;
>        //code review comment - to ensure parameters size is either 2 or 3.
>        if(parameters.length < 2 || parameters.length > 3)
>        {   throw new IllegalArgumentException("Number of parameters to verify/add node
invalid ");
>        }
>        NodeIterator iterator = queryForPath(session,parameters[0]);
>        if(iterator.hasNext())
>        {   log.info("Node exists in this path...");
>            node2Add = iterator.nextNode();
>        }else
>        {   if(parameters.length == 2)
>                node2Add = parent.addNode(parameters[1]);
>            else
>               node2Add = parent.addNode(parameters[1],parameters[2]);
>        }
>        return node2Add;
>    }

The "parameters" handling seems broken. You call the above method with

>           Node account = verifyAndAddNode(session,candidatedocs,path,"lc:account");

in which case parameters.length = 2 and the addNode() call will be
done without the node type. Also, the indexes look wrong to me:
parameters[1], which is used as the node name in the addNode() call,
will be "lc:account" in your case - the nodetype.

Regards,
Alex

--
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message