Le 30/01/2017 à 20:39, [email protected] a écrit : > Thx for the patch. (Btw is that an svn patch? Indeed... We probably wil migrate to Git after 2.0.
> 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. It seems that you are converting a DSML request to a LDAP request, but that the DsmlControl does not get converted in the process, is that correct ? The SortRequestDecorator.computeLength is epxecting a SortControl instance, when the DSMLControl is untyped. At some point, we should make it so a DSMLControl is encapsulated into a typed control, and that would either require a big convertor (ie, a method that check the control's OID and create a typed control), or specific DSML controls for each type of control. I would go for option 2, it's more 'solid'. Is it possible for you to provide a bit of code demonstrating the problem (ideally, a unit test) ? I'd like to debug it in order to see what's going on, and git this fixed. thanks -- Emmanuel Lecharny Symas.com directory.apache.org
