Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
2.4.0
-
None
Description
We are currently migrating/upgrading our grouper 2.3 to the containerized 2.4 and we have run into a major difference of behavior between the LDAP implementations of Grouper 2.3 and the two from 2.4^1^ that cause a loader that used to run correctly on 2.3 to produce the following stack trace:
java.lang.RuntimeException: java.util.NoSuchElementException: Error querying ldap server id: ldapr, searchDn: ou=groupes,dc=something,dc=ca, filter: '(cn=filter*)', returning subject attribute: member
|
at edu.internet2.middleware.grouper.app.loader.db.GrouperLoaderResultset.initForLdapListOfGroups(GrouperLoaderResultset.java:752)
|
at edu.internet2.middleware.grouper.app.loader.GrouperLoaderType$10.runJob(GrouperLoaderType.java:1011)
|
at edu.internet2.middleware.grouper.app.loader.GrouperLoaderJob.runJobLdap(GrouperLoaderJob.java:642)
|
at edu.internet2.middleware.grouper.app.loader.GrouperLoaderJob.execute(GrouperLoaderJob.java:337)
|
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
|
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
|
Caused by: java.util.NoSuchElementException: Error querying ldap server id: ldapr, searchDn: ou=groupes,dc=something,dc=ca, filter: '(cn=filter*)', returning subject attribute: member
|
at java.util.ArrayList$Itr.next(ArrayList.java:862)
|
at edu.internet2.middleware.grouper.app.loader.db.GrouperLoaderResultset.initForLdapListOfGroups(GrouperLoaderResultset.java:689)
|
... 5 more
|
This exception occurs when an attribute declared in "Extra LDAP attributes"2 ** is absent in some results rows (it is normal for optional attributes to be absent). I initially traced the bug to that faulty construct in GrouperLoaderResultset :
String attributeValue = groupAttribute.getStringValues().iterator().next();
|
And I feel that the correct patch would be to add the following condition :
if(!attribute.getValues().isEmpty()) |
before https://github.com/Internet2/grouper/blob/5e07ec70005ef066acf9505bcb7329a5a6c9a991/grouper/src/grouper/edu/internet2/middleware/grouper/ldap/ldaptive/LdaptiveSessionImpl.java#L759 and https://github.com/Internet2/grouper/blob/5e07ec70005ef066acf9505bcb7329a5a6c9a991/grouper/src/grouper/edu/internet2/middleware/grouper/ldap/vtldap/VTLdapSessionImpl.java#L541
- using VTLdapSessionImpl or LdaptiveSessionImpl does not changes the outcome
- etc:attribute:loaderLdap:grouperLoaderLdapExtraAttributes