Skip to content
This repository has been archived by the owner on Apr 29, 2018. It is now read-only.

Commit

Permalink
Merge pull request #26 from gostaj/master
Browse files Browse the repository at this point in the history
Fixed NullPointerException when filling attributes in empty group
  • Loading branch information
phaus authored Jan 24, 2017
2 parents 49dbb7e + 191a3ba commit d18c88d
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1134,12 +1134,16 @@ private LdapGroup fillAttributesInGroup(LdapGroup group, Attributes attributes)
group.setCn(getAttributeOrNa(attributes, key));
}
}
NamingEnumeration<?> members = attributes.get(groupMemberAttribut).getAll();
while (members.hasMoreElements()) {
String memberDN = (String) members.nextElement();
member = new LdapUser(getUidForDN(memberDN), this);
member.setDn(memberDN);
group.addUser(member);

Attribute membersAttribute = attributes.get(groupMemberAttribut);
if (membersAttribute != null) {
NamingEnumeration<?> members = membersAttribute.getAll();
while (members.hasMoreElements()) {
String memberDN = (String) members.nextElement();
member = new LdapUser(getUidForDN(memberDN), this);
member.setDn(memberDN);
group.addUser(member);
}
}
} catch (NamingException ex) {
handleNamingException(group, ex);
Expand Down

0 comments on commit d18c88d

Please sign in to comment.