You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by dbac <64...@qq.com> on 2012/10/23 02:58:46 UTC

setPolicy javax.jcr.ItemExistsException? bug???

 
aclNode = acNode.getNode(N_POLICY);
            // remove all existing aces
            for (NodeIterator aceNodes = aclNode.getNodes();
aceNodes.hasNext();) {
                NodeImpl aceNode = (NodeImpl) aceNodes.nextNode();
                removeItem(aceNode);
            }
            
            System.out.println(aclNode.getNodes().getSize());  //0
             but  aclNode.getNodeState().getChildNodeEntries().size()  //59 
why not 0???

            why?
             because this problem,  when  add  a node ,its name  is  in
these childNodeEntries  ,so  ItemExistsException,  it's a bug??  



--
View this message in context: http://jackrabbit.510166.n4.nabble.com/setPolicy-javax-jcr-ItemExistsException-bug-tp4656857.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: setPolicy javax.jcr.ItemExistsException? bug???

Posted by Angela Schreiber <an...@adobe.com>.
hi

the access control content is protected and you cannot
remove it using regular JCR write operations.

please use methods provided by AccessControlManager and 
AccessControlList to get/set policies and manipulate the
set of ACEs, respectively. You may even want to use the
AccessControlUtils present with jcr-commons if you use
the default ac-model present with jackrabbit.

i suspect that your 'removeItem' method catches the
ConstraintViolationException that is thrown when trying
to modify protected items... in any case the ACE node
was most probably never removed which in turn explains
the ItemExistsException and the non-zero size.

bref: not a bug. user error :)

regards
angela



On 10/23/12 2:58 AM, dbac wrote:
>
> aclNode = acNode.getNode(N_POLICY);
>              // remove all existing aces
>              for (NodeIterator aceNodes = aclNode.getNodes();
> aceNodes.hasNext();) {
>                  NodeImpl aceNode = (NodeImpl) aceNodes.nextNode();
>                  removeItem(aceNode);
>              }
>
>              System.out.println(aclNode.getNodes().getSize());  //0
>               but  aclNode.getNodeState().getChildNodeEntries().size()  //59
> why not 0???
>
>              why?
>               because this problem,  when  add  a node ,its name  is  in
> these childNodeEntries  ,so  ItemExistsException,  it's a bug??
>
>
>
> --
> View this message in context: http://jackrabbit.510166.n4.nabble.com/setPolicy-javax-jcr-ItemExistsException-bug-tp4656857.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.