[ http://issues.apache.org/jira/browse/DIRSERVER-214?page=all ] Emmanuel Lecharny closed DIRSERVER-214: ---------------------------------------
fixed > ClassCast excpetion in org.apache.ldap.common.berlib.asn1.SnickersEncoder > ------------------------------------------------------------------------- > > Key: DIRSERVER-214 > URL: http://issues.apache.org/jira/browse/DIRSERVER-214 > Project: Directory ApacheDS > Type: Bug > Components: ldap > Versions: pre-1.0 > Environment: Not relevant > Reporter: Emmanuel Lecharny > Assignee: Alex Karasulu > Priority: Blocker > Fix For: pre-1.0 > Attachments: clients.tar.gz > > I get a ClassCast exception while running LdapSearch main : > java.lang.ClassCastException > at > org.apache.ldap.common.berlib.asn1.SnickersEncoder$OutputCallback.encodeOccurred(SnickersEncoder.java:177) > at > org.apache.asn1.codec.stateful.AbstractStatefulEncoder.encodeOccurred(AbstractStatefulEncoder.java:130) > at > org.apache.asn1.ber.TupleEncodingVisitor.flush(TupleEncodingVisitor.java:173) > at > org.apache.ldap.common.berlib.asn1.encoder.SnickersLdapEncoder.encode(SnickersLdapEncoder.java:209) > at > org.apache.ldap.common.berlib.asn1.SnickersEncoder.encodeBlocking(SnickersEncoder.java:66) > at > org.apache.ldap.common.message.MessageEncoder.encodeBlocking(MessageEncoder.java:90) > at org.apache.ldap.clients.LdapBind.bind(LdapBind.java:350) > at org.apache.ldap.clients.LdapSearch.main(LdapSearch.java:408) > public void encodeOccurred(StatefulEncoder encoder, Object encoded) { > try > { > channel.write( ( ByteBuffer ) encoded ); <--- Object is > supposed to be a ByteBuffer [], not a ByteBuffer > Substituing those lines to the one that cause the exception seems to correct > it : > public void encodeOccurred(StatefulEncoder encoder, Object encoded) { > try > { > //channel.write( ( ByteBuffer ) encoded ); <--- Object is > supposed to be a ByteBuffer [], not a ByteBuffer > ByteBuffer[] buffers = (ByteBuffer[])encoded; > > // int nbWritten = 0; // for debug sake > > for (int i=0; i<buffers.length; i++) { > //nbWritten += channel.write(buffers[i]); > channel.write(buffers[i]); > } > > // System.out.println("Bytes written (" + nbWritten + ") :"); > ... > No more exception, then, but, as far as I went, it does not help the whole > thing to work correctly. I do not receive any answer from my favorite > OpenLdap server. I'm currently checking the PDU to see if it's FUBR or not > (ethereal to the rescue). Takes time... -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
