directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Lecharny (JIRA)" <directory-...@incubator.apache.org>
Subject [jira] Created: (DIRLDAP-28) ClassCast excpetion in org.apache.ldap.common.berlib.asn1.SnickersEncoder
Date Sun, 30 Jan 2005 14:27:17 GMT
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
 Assigned to: Alex Karasulu 
    Priority: Blocker


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


Mime
View raw message