You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Alec de Zegher (JIRA)" <ji...@apache.org> on 2014/01/22 18:03:22 UTC

[jira] [Created] (FELIX-4399) UserAdmin MongoDB plugin cannot return role when properties or members is null

Alec de Zegher created FELIX-4399:
-------------------------------------

             Summary: UserAdmin MongoDB plugin cannot return role when properties or members is null
                 Key: FELIX-4399
                 URL: https://issues.apache.org/jira/browse/FELIX-4399
             Project: Felix
          Issue Type: Bug
          Components: User Admin
         Environment: MongoDB 32-bit, v2.4.9
Java 1.7
UserAdmin 1.0.3
            Reporter: Alec de Zegher


When fetching a role with no properties or roles from mongodb, a null object is returned by the DB. This causes a null pointer exception.

This can be solved by changing two methods in MongoSerializerHelper.java to:
    private void deserializeDictionary(Dictionary dictionary, DBObject object) {
        if(object != null) {
	    	for (String key : object.keySet()) {
	            dictionary.put(KeyCodec.decode(key), object.get(key));
	        }
        }
    }


   private List<Role> getRoles(BasicDBList list) {
        List<Role> result = new ArrayList<Role>();
        if(list !=null) {
	        for (int i = 0, size = list.size(); i < size; i++) {
	            final String memberName = (String) list.get(i);
	            result.add(findExistingMember(memberName));
	        }
        }
        return result;
    }





--
This message was sent by Atlassian JIRA
(v6.1.5#6160)