Showing results for 
Search instead for 
Did you mean: 

Read KM ACL Null Pointer

Active Participant
0 Kudos


I'm just trying to read the ACLs of some portal ressources. I found some threads that describe exactly what I want to do. But all this threads are resolved and it seems, nobody gets the same error. Following, there is my code. A little shortened without try/catches. The Problem is, that I get a NullPointerException in the Line

"IResourceAclEntryList acllist = acl.getEntries();" this means to me, that I get the IResourceAclManager, but I don't get any ACLs. Has anybody a clue, why I don't get an ACLs?

Best regards,

Christian sapUser = request.getUser(); ep5User = null;
ep5User = com.sapportals.wcm.util.usermanagement.WPUMFactory.getUserFactory().getEP5User(sapUser);

ResourceContext context = new ResourceContext(ep5User);
RID rid = RID.getRID("/documents");
IResourceFactory factory = ResourceFactory.getInstance();

ICollection folder = (ICollection) factory.getResource(rid, context);

ArrayList al = new ArrayList();

IResourceListIterator it = folder.getChildren().listIterator();

if (it != null) {

	while (it.hasNext()) {

		IResource res =;
		String name = res.getName();
		String rawRid = res.getRID().toString();
		boolean isFolder = res.isCollection();

		IResourceFactory resFactory = ResourceFactory.getInstance();
		IRepositoryServiceFactory repServiceFactory = resFactory.getServiceFactory();
		IAclService aclService = 
(IAclService) repServiceFactory.getRepositoryService(res, "ServiceAclRepositoryService");
		IResourceAclManager aclMgr = aclService.getAclManager();
		IResourceAcl acl = aclMgr.getAcl(res);
		if (acl == null) {
			response.write("ACL = NULL");
			acl = aclMgr.getInheritedAcl(res);
		IResourceAclEntryList acllist = acl.getEntries();
		IResourceAclEntryListIterator listIt = acllist.iterator();

Accepted Solutions (1)

Accepted Solutions (1)

Active Contributor
0 Kudos


Try with this code ...

ISecurityManager sm = res.getRepositoryManager().getSecurityManager(res);
if (sm != null && sm instanceof IAclSecurityManager) {
        IAclSecurityManager asm = (IAclSecurityManager) sm;
        IResourceAclManager ram = asm.getAclManager();
        IResourceAcl ra = ram.getAcl(res);
        if (ra == null) {
			response.write("ACL = NULL");
			ra = ram.getInheritedAcl(res);

        IResourceAclEntryList rel = ra.getEntries();

Check this message also



Answers (1)

Answers (1)

Active Participant
0 Kudos

A great thank you to BP.

Best regards,