You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Emmanuel Lecharny (JIRA)" <di...@incubator.apache.org> on 2005/02/02 01:32:17 UTC

[jira] Updated: (DIRLDAP-28) ClassCast excpetion in org.apache.ldap.common.berlib.asn1.SnickersEncoder

     [ http://issues.apache.org/jira/browse/DIRLDAP-28?page=history ]

Emmanuel Lecharny updated DIRLDAP-28:
-------------------------------------

    Attachment: clients.tar.gz

standelone package DOES NOT COMPILE actually. I don't think that this module is usefull anyway...

> ClassCast excpetion in org.apache.ldap.common.berlib.asn1.SnickersEncoder
> -------------------------------------------------------------------------
>
>          Key: DIRLDAP-28
>          URL: http://issues.apache.org/jira/browse/DIRLDAP-28
>      Project: Directory LDAP
>         Type: Bug
>   Components: Snickers Codec Provider
>     Versions: 0.8.0
>  Environment: Not relevant
>     Reporter: Emmanuel Lecharny
>     Assignee: Alex Karasulu
>     Priority: Blocker
>  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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira