Uploaded image for project: 'Directory Client API'
  1. Directory Client API
  2. DIRAPI-288

Space between LDAP filter conditions causes NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Not A Problem
    • 1.0.0-M32, 1.0.0-RC2
    • None
    • None
    • Win7 x64 Java 1.7.0_51 - Query against Active Directory 2008

    Description

      Hi, When setting a filter on a request having multiple conditions, if there are spaces after operators or between clauses, this causes a NullPointerException. I'm not sure but I think the spec ignores this type of white space. I tested the same problematic query with JNDI and it executes without issue. I don't think the backend LDAP vendor matters, it seems to fail in the api before the request is sent.

      Query with no spaces between parenthetical conditions or after logical OR '|' and the query executes as expected.

      (|(memberOf=cn=group1,ou=test)(memberOf=cn=group2,ou=test))

      Having a space after the logical OR operator and/or between conditions (not sure which) throws NPE.

      Structure a query like this to reproduce where ^=space
      (|(memberOf=cn=group1,ou=test)(memberOf=cn=group2,ou=test))

      Found in api ver M32 and tested also in RC2..

      at java.lang.Thread.run(Unknown Source) [na:1.7.0_51]
      Caused by: java.lang.NullPointerException: null
      at org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator.computeLength(SearchRequestDecorator.java:930) ~[api-all-1.0.0-RC2.jar:1.0.0-RC2]
      at org.apache.directory.api.ldap.codec.api.LdapEncoder.computeMessageLength(LdapEncoder.java:250) ~[api-all-1.0.0-RC2.jar:1.0.0-RC2]
      at org.apache.directory.api.ldap.codec.api.LdapEncoder.encodeMessage(LdapEncoder.java:160) ~[api-all-1.0.0-RC2.jar:1.0.0-RC2]
      at org.apache.directory.api.ldap.codec.protocol.mina.LdapProtocolEncoder.encode(LdapProtocolEncoder.java:81) ~[api-all-1.0.0-RC2.jar:1.0.0-RC2]
      at org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCodecFilter.java:306) ~[mina-core-2.0.9.jar:na]
      ... 53 common frames omitted
      java.lang.NullPointerException

      Thanks for all your hard work and happy holidays!

      Attachments

        Activity

          People

            Unassigned Unassigned
            caccorsi Carlo Accorsi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: