What could cause FileNet exception in adding permissions to a folder?

I have a custom application that is built on top of the FileNet Content Java API, CE 5.2.1
Part of the application creates a FileNet folder, and then adds an access permission. This runs 24 x 7, without problem, but on the odd occasion it throws an exception.
Here is the code in question:

int
READER_ACCESS_RIGHT=AccessRight.READ.getValue() + AccessRight.VIEW_CONTENT.getValue() + AccessRight.READ_ACL.getValue();
int INHERITANCE_OBJECT_AND_ALL_CHILDREN=-1;

ldapgrp = CreateNewLdapGroup(dn); ap = Factory.AccessPermission.createInstance();
ap.set_GranteeName(ldapgrp.getDistinguishedName);
ap.set_AccessType(AccessType.ALLOW);
ap.set_AccessMask(READER_ACCESS_RIGHT);
ap.set_InheritableDepth(INHERITANCE_OBJECT_AND_ALL_CHILDREN);

AccessPermissionList apl = folder.get_Permissions();
apl.add(ap);
folder.set_Permissions(apl);
folder.save(RefreshMode.REFRESH);

The exception is:
com.filenet.api.exception.EngineRuntimeException: FNRCE0051E: E_OBJECT_NOT_FOUND: The requested item was not found. propertyName=Permissions, referenced principal=CN=XY_26999 [etc] in Domain {00000000-0000-0000-0000-000000000000}

So, the error is essentially indicating that it is unable to find the LDAP group specified, suggesting maybe that it doesn’t exist. However, later checks show that the LDAP group does indeed exist.
And bear in mind that this code works 99% of the time.

Related:

Leave a Reply