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

Emmanuel Lecharny commented on DIRAPI-288:
------------------------------------------

Sorry for the delayed answer, I had some trouble with some changes I have done 
locally on my code base that was blocking me for testing yur scenario.

Actually, the whole parser expects the filter to not have any space anywhere, 
accordingly to [RFC4234](https://tools.ietf.org/search/rfc4234) - ie, spaces 
must be explicitely declared in the grammar).

Although correct, it's a bit too strict for the end user, and we should 
probably relax the filter syntax to allow unsignificant spaces to be ignored.

> 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)

Reply via email to