You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Carlo Accorsi (JIRA)" <ji...@apache.org> on 2016/12/21 21:36:58 UTC

[jira] [Commented] (DIRAPI-288) Space between LDAP filter conditions causes NPE

    [ https://issues.apache.org/jira/browse/DIRAPI-288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15768232#comment-15768232 ] 

Carlo Accorsi commented on DIRAPI-288:
--------------------------------------

The ^ formatted the query instead of remaining a literal to represent a space. 

This is the problem query format: space after | and between to conditions.
(| (memberOf=cn=group1,ou=test) (memberOf=cn=group2,ou=test))

> Space between LDAP filter conditions causes NPE
> -----------------------------------------------
>
>                 Key: DIRAPI-288
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-288
>             Project: Directory Client API
>          Issue Type: Bug
>    Affects Versions: 1.0.0-M32, 1.0.0-RC2
>         Environment: Win7 x64 Java 1.7.0_51 - Query against Active Directory 2008
>            Reporter: Carlo Accorsi
>            Priority: Minor
>
> 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!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)