[ 
http://jira.amdatu.org/jira/browse/AMDATU-403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11281#comment-11281
 ] 

Bram de Kruijff commented on AMDATU-403:
----------------------------------------

I think the piece of code that causes the NPE maybe should be removed/replaced 
rather then fixed!. It seems it adds new roles to each cache entry regardless 
of wether it matches the filter :S?

                    for (Entry<String, Role[]> roles : 
m_filteredRoleCache.entrySet()) {
                        Role[] newRoles = new Role[roles.getValue().length+1];
                        for (int i=0; i<roles.getValue().length; i++) {
                            newRoles[i] = roles.getValue()[i];
                        }
                        newRoles[roles.getValue().length] = role;
                        m_filteredRoleCache.put(roles.getKey(), newRoles);
                    }
                    return role;

> 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
>    Affects Versions: 0.3.0-M0
>            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