Skip to content

Commit d33871a

Browse files
committed
fix(core): correctly store first EPPN in LDAP
- We encountered possible NULL value if user had no EPPNs.
1 parent 4336cca commit d33871a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

perun-ldapc/src/main/java/cz/metacentrum/perun/ldapc/model/impl/PerunUserImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ public void addPrincipal(User user, String login) {
149149
if (isEppnEpuidLogin(login)) {
150150

151151
String[] oldEppns = entry.getStringAttributes(PerunAttribute.PerunAttributeNames.ldapAttrEduPersonPrincipalNames);
152+
if (oldEppns == null) oldEppns = new String[0];
152153
TreeSet<String> uniqueEppns = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
153154
uniqueEppns.addAll(Stream.of(oldEppns).collect(Collectors.toSet()));
154155

@@ -161,6 +162,7 @@ public void addPrincipal(User user, String login) {
161162
}
162163

163164
String[] oldIdentities = entry.getStringAttributes(PerunAttribute.PerunAttributeNames.ldapAttrUserIdentities);
165+
if (oldIdentities == null) oldIdentities = new String[0];
164166
TreeSet<String> uniqueIdentities = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
165167
uniqueIdentities.addAll(Stream.of(oldIdentities).collect(Collectors.toSet()));
166168

0 commit comments

Comments
 (0)