directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "clauds2x@gmail.com" <claud...@gmail.com>
Subject Re: [LDAP API 1.0.0-RC2] server side sorting control with DSMLv2
Date Mon, 30 Jan 2017 19:39:53 GMT
Thx for the patch. (Btw is that an svn patch? I was unable to apply it 
using "git apply" and using "patch -p0" I had rejects for every file so 
I had to make most changes manually...)

With the patch I still get the issue, just now in a different place:

Caused by: java.lang.ClassCastException: 
org.apache.directory.api.dsmlv2.DsmlControl cannot be cast to 
org.apache.directory.api.ldap.model.message.controls.SortRequest
     at 
org.apache.directory.api.ldap.codec.controls.sort.SortRequestDecorator.getSortKeys(SortRequestDecorator.java:219)
     at 
org.apache.directory.api.ldap.codec.controls.sort.SortRequestDecorator.computeLength(SortRequestDecorator.java:98)
     at 
org.apache.directory.api.ldap.codec.api.LdapEncoder.computeControlLength(LdapEncoder.java:73)[89:org.apache.directory.api.ldap.codec.core:1.0.0.RC3-SNAPSHOT]
     at 
org.apache.directory.api.ldap.codec.api.LdapEncoder.computeMessageLength(LdapEncoder.java:279)[89:org.apache.directory.api.ldap.codec.core:1.0.0.RC3-SNAPSHOT]
     at 
org.apache.directory.api.ldap.codec.api.LdapEncoder.encodeMessage(LdapEncoder.java:160)[89:org.apache.directory.api.ldap.codec.core:1.0.0.RC3-SNAPSHOT]
     at 
org.apache.directory.api.ldap.codec.protocol.mina.LdapProtocolEncoder.encode(LdapProtocolEncoder.java:82)
     at 
org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCodecFilter.java:299)
     ... 58 more

I still have the feeling the issue is in the DSML lib rather than in the 
codec... IMHO DsmlControl should never reach the codec but it does, it 
gets wrapped:

# SortRequestDecorator:219

this    SortRequestDecorator  (id=12610)
     decorated    DsmlControl<C>  (id=12489)
         decorated    SortRequestDecorator  (id=12486)
             decorated    SortRequestControlImpl  (id=12619)

AbstractDsmlMessageDecorator is used by both request and response, 
addControl wraps the control into a DsmlControl if it isn't already... 
in case of request I would have expected the control to be added to the 
control map as is (without wrapping into DsmlControl). However, checking 
e.g. SearchRequestTest.testRequestWith1Control it expects DsmlControl in 
the assertion even though the request type is 
org.apache.directory.api.ldap.model.message.SearchRequest and not 
SearchRequestDsml.

On 30/01/17 15:12, Emmanuel Lécharny wrote:
> I have patched teh API code in a way that should solve the issue. Can
> you give it a tr, applying this patch :
>
>
> https://paste.apache.org/GDVb
>
>
> ?
>
>
> Le 30/01/2017 à 11:37, clauds2x@gmail.com a écrit :
>> We don't directly send DSML, we have a custom version of Dsmlv2Engine
>> that uses org.apache.directory.api.dsmlv2.Dsmlv2Parser. The issue only
>> occurs if we provide the sort control, the code we have is working
>> otherwise.
>>
>> I am curious if anybody out there is successfully using the sort
>> control with DSMLv2 (OSGi or non-OSGi setup) ?
>> If registering SortRequestFactory/SortResponseFactory was the only
>> known missing part (for OSGI setup) I suspect a bug in the
>> decorator/Dsmlv2Grammar/... Debugging I so far haven't been able to
>> pinpoint where it goes wrong but I will see what I can do, trying to
>> narrow it down and maybe produce a small test to reproduce the issue.
>>
>> On 28/01/17 09:32, Emmanuel Lécharny wrote:
>>> Le 27/01/2017 à 19:13, clauds2x@gmail.com a écrit :
>>>> Thanks for the fix.
>>>>
>>>> As I wrote initially I had already tried with registering the two
>>>> factories and got a ClassCastException.
>>>> I tried now with RC3 but as suspected I still get the same
>>>> ClassCastException:
>>>>
>>>> java.lang.ClassCastException:
>>>> org.apache.directory.api.dsmlv2.DsmlControl cannot be cast to
>>>> org.apache.directory.api.ldap.model.message.controls.SortRequest
>>>> org.apache.mina.filter.codec.ProtocolEncoderException:
>>>> java.lang.ClassCastException:
>>>> org.apache.directory.api.dsmlv2.DsmlControl cannot be cast to
>>>> org.apache.directory.api.ldap.model.message.controls.SortRequest
>>>>       at
>>>> org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCodecFilter.java:330)
>>>>
>>>>       at
>>>> org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:629)
>>>>
>>>>       at
>>>> org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1500(DefaultIoFilterChain.java:48)
>>>>
>>>>       at
>>>> org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterWrite(DefaultIoFilterChain.java:957)
>>>>
>>>>       at
>>>> org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterWrite(DefaultIoFilterChain.java:881)
>>>>
>>>>       at
>>>> org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:629)
>>>>
>>>>       at
>>>> org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterWrite(DefaultIoFilterChain.java:622)
>>>>
>>>>       at
>>>> org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:574)
>>>>
>>>>       at
>>>> org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:519)
>>>>
>>>>       at
>>>> org.apache.directory.ldap.client.api.LdapNetworkConnection.writeRequest(LdapNetworkConnection.java:4244)[88:org.apache.directory.api.ldap.client.api:1.0.0.RC3-SNAPSHOT]
>>>>
>>>>       at
>>>> org.apache.directory.ldap.client.api.LdapNetworkConnection.searchAsync(LdapNetworkConnection.java:1838)[88:org.apache.directory.api.ldap.client.api:1.0.0.RC3-SNAPSHOT]
>>>>
>>>>       at
>>>> org.apache.directory.ldap.client.api.LdapNetworkConnection.search(LdapNetworkConnection.java:1865)[88:org.apache.directory.api.ldap.client.api:1.0.0.RC3-SNAPSHOT]
>>>>
>>>>
>>>> ...
>>>>
>>>> Caused by: java.lang.ClassCastException:
>>>> org.apache.directory.api.dsmlv2.DsmlControl cannot be cast to
>>>> org.apache.directory.api.ldap.model.message.controls.SortRequest
>>>>       at
>>>> org.apache.directory.api.ldap.codec.controls.sort.SortRequestFactory.newCodecControl(SortRequestFactory.java:35)
>>>>
>>>>       at
>>>> org.apache.directory.api.ldap.codec.osgi.DefaultLdapCodecService.newControl(DefaultLdapCodecService.java:275)
>>>>
>>>>       at
>>>> org.apache.directory.api.ldap.codec.api.MessageDecorator.addControl(MessageDecorator.java:340)[89:org.apache.directory.api.ldap.codec.core:1.0.0.RC3-SNAPSHOT]
>>>>
>>>>       at
>>>> org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator.addControl(SearchRequestDecorator.java:1118)
>>>>
>>>>       at
>>>> org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator.addControl(SearchRequestDecorator.java:83)
>>>>
>>>>       at
>>>> org.apache.directory.api.ldap.codec.api.MessageDecorator.getDecorator(MessageDecorator.java:225)[89:org.apache.directory.api.ldap.codec.core:1.0.0.RC3-SNAPSHOT]
>>>>
>>>>       at
>>>> org.apache.directory.api.ldap.codec.api.LdapEncoder.encodeMessage(LdapEncoder.java:159)[89:org.apache.directory.api.ldap.codec.core:1.0.0.RC3-SNAPSHOT]
>>>>
>>>>       at
>>>> org.apache.directory.api.ldap.codec.protocol.mina.LdapProtocolEncoder.encode(LdapProtocolEncoder.java:82)
>>>>
>>>>       at
>>>> org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCodecFilter.java:299)
>>>>
>>>>
>>>> I have the feeling that some link between DSML and codec is missing
>>>> for the (sort) control...
>>> Most certainly. D you have a fragment of code I can play with to find
>>> out what's going on ?
>>>


Mime
View raw message