UserAdmin cache aspect service can't handle NULL return from 
UserAdmin#getRoles(..)
-----------------------------------------------------------------------------------

                 Key: AMDATU-403
                 URL: http://jira.amdatu.org/jira/browse/AMDATU-403
             Project: Amdatu
          Issue Type: Bug
          Components: Amdatu Core
            Reporter: Bram de Kruijff


While playing around with ACE deployment I get the follow stacktrace on startup:

[2011-07-27 16:19:13] WARNING: Invocation of 'start' failed. 
[org.apache.ace.configurator.useradmin.task]
null
java.lang.NullPointerException
        at 
org.amdatu.core.useradmincache.service.UserAdminCache.createRole(UserAdminCache.java:94)
        at 
org.apache.ace.resourceprocessor.useradmin.impl.UserAdminStore.updateRole(UserAdminStore.java:206)


Initial analysis: 

0) Whenever a call to getRoles(...) return null this is stored in the local 
m_filteredRoleCache map
1) A subsequent call to createRole(..) iterates over m_filteredRoleCache and 
can't handle null values
2) So the test would be...

    @Test
    public void testNPE() throws Exception {
        // Create the UserAdminCache
        UserAdminCache userAdminCache = createUserAdmin();
        userAdminCache.getRoles(null);
        userAdminCache.createRole("NPE", Role.USER);
    }

3) But that does not fail because UserAdminMock#getRoles(..) returns Roles[]{} 
rather then null
4) However the spec says "If no roles match the filter, null will be returned." 
(OSGi cpmn R42 107.8.6.4)



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
Amdatu-developers mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-developers

Reply via email to