Unable to get ldap attribute

1
0
-1

Hi everyone, !

I'm currently trying to store in a Hashmap object the value and key of the ldapAttributeList returned by my ldap connector using the the output operation window. Here is a piece of code doing this thing :

  1. import org.bonitasoft.connectors.ldap.LdapAttribute;
  2. def temp_list = [:]
  3. ldapAttributeList[0].each {
  4. temp_list.put((it.getName()), (it.getValue()))
  5. }
  6. return new HashMap<String, String>(temp_list)

So to resume, I'm getting every attribute form the output of my ldap connector, storing them in a hasmap object and returning it.

When I test this piece of code in a test connector it return that : screenshot So correct me if I'm wrong but this piece of code is actually working.

Now when I'm trying to use the same connector but with filled-by-variables fields such as a login and password field the connector fails.

Key elements : -- I'm currently using the Bonita Community pack (version 6.2.6), in a windows Seven professional 64 bits. -- The problem is not linked with a bad credentials. -- My code works when I only try to invoke the ldapAttribute.getName() like this :

  1. import org.bonitasoft.connectors.ldap.LdapAttribute;
  2. def temp_list = [:]
  3. ldapAttributeList[0].each {
  4. temp_list.put((it.getName()), (it.getName()))
  5. }
  6. return new HashMap<String, String>(temp_list)

-- But when I try to use the piece of code in the top of the question, the connector fails. -- I tried to get the exception thrown by the ldapAttribute.getValue() methods, here is what I get :

  1. java.lang.NullPointerException: Cannot invoke method getAt() on null objectdescription= <<the good value i'm trying to get>>

So it is confirmed that the getValue() method throw the exception, I've checked the source code and i don't know what's wrong. -- I even tried to clone the ldapAttribute in order not to use the getValue() method, but it doesn't work as it seems that the clone() method has not been implemented, so I'm completely stucked and i look forward to hear you suggestions.

Thank you for all !

No answers yet.
Notifications