1 Reply Latest reply on Aug 25, 2010 8:04 AM by Michal Petrik

    Can't delete role without group with JpaIdentityStore.deleteRole()

    Oso Pardo Newbie

      Hello,


      I created some roles with JpaIdentityStore.createRole(String roleName) method but when I try to delete them with JpaIdentityStore.deleteRole(String roleName) I get a NullPointerException on line 563 in JpaIdentityStore.java :


      JpaIdentityStore.java


      562: List<String> roles = listRoleMembers(role);
      563: for (String r : roles)
      564: {
      565:   removeRoleFromGroup(r, role);
      565: }




      private List<String> listRoleMembers(String role)
         {                
            if (roleGroupsProperty.isSet())
            {
               Object roleEntity = lookupRole(role);                  
               
               return lookupEntityManager().createQuery("select r." + roleNameProperty.getName() +
                     " from " + roleClass.getName() + " r where :role member of r." + roleGroupsProperty.getName())
                     .setParameter("role", roleEntity)
                     .getResultList();
            }
            
            return null;
         }



      JpaIdentityStore.initProperties()


      roleGroupsProperty = new AnnotatedBeanProperty(roleClass, RoleGroups.class);
      [...]



      So it seems that JpaIdentityStore can't delete a role if we haven't set the @RoleGroups annotation, whereas the documentation say its optional : Table 15.2. Role Entity Annotations



      Did I miss something here ?