06-24-06 06:11 PM
[ http://issues.apache.org/jira/brows...ER-212?page=all ]
Emmanuel Lecharny closed DIRSERVER-212:
---------------------------------------
Strange bug I created Let's close it
> Class SnickersEncoder does not send data with a WritableByteChannel on Lin
ux
> --------------------------------------------------------------------------
--
>
> Key: DIRSERVER-212
> URL: http://issues.apache.org/jira/browse/DIRSERVER-212
> Project: Directory ApacheDS
> Type: Bug
> Components: ldap
> Versions: pre-1.0
> Environment: Linux Fedora Core 3
> Reporter: Emmanuel Lecharny
> Assignee: Alex Karasulu
> Priority: Blocker
> Fix For: pre-1.0
>
> Tracking the problem described in DIRLDAP-28 jira issue, I finally discovered that
data are not sent through the socket using a WritableByteChannel. I replaced it by
an OutputStream in the OutputCallback inner class, added a flush() in the encodeOccu
rre
d method, and everything went well, ethereal was quite happy to show a LDAP packet with the
full (correct) BindRequest.
> My OutputCallback innerclass :
> class OutputCallback implements EncoderCallback {
> // private WritableByteChannel m_channel = null; // Does not send
data, don't know why?
> private OutputStream m_out; // back to old API
> /**
> * Callback to deliver a fully encoded object.
> *
> * @param encoder
> * the stateful encoder driving the callback
> * @param encoded
> * the object that was encoded
> */
> public void encodeOccurred(StatefulEncoder encoder, Object encoded)
{
> try {
> ByteBuffer[] buffers = (ByteBuffer[])encoded;
>
> for (int i=0; i<buffers.length; i++) {
> m_out.write(buffers[i].array());
> }
>
> m_out.flush(); // don't forget to flush !!!
> } catch (IOException e) {
> e.printStackTrace();
> }
> }
> void attach(WritableByteChannel channel) {
> m_channel = channel;
> }
> void attach(OutputStream out) {
> m_out = out;
> // m_channel = Channels.newChannel(out);
> }
> I also tried to close the channel instead of using an OutputStream (just b
y replacing flush by a close), but that is not an option : you can't anymore
read the response...
> I may have missed something about channels? Or is this a bug? I'm not very experie
nced with NIO (the hendrix way of being experienced...), but I'll tried to improve m
y knowledge by browsing Sun code, just to check. Didn't had time to test it unde M$,
bu
t I gonna switch on my close source machine in a couple of hours.
> Whatever, I still can't get a correct answer :
> [main] DEBUG BERDigester - Rule org.apache.asn1.ber.digester.rules.Pr
imitiveIntDecodeRule@d19bc8 fired successfully by digester org.apache.asn1.b
er.digester.BERDigester@14a8cd1
> 29 [main] DEBUG BERDigester - Rule org.apache.ldap.common.berlib.asn1
.decoder.ResultMatchedDNRule@2a4983 fired successfully by digester org.apach
e.asn1.ber.digester.BERDigester@14a8cd1
> 29 [main] DEBUG BERDigester - Rule org.apache.ldap.common.berlib.asn1
.decoder.ErrorMessageRule@406199 fired successfully by digester org.apache.a
sn1.ber.digester.BERDigester@14a8cd1
> 29 [main] DEBUG BERDigester - Rule org.apache.ldap.common.berlib.asn1
.decoder.ResultMatchedDNRule@2a4983 fired successfully by digester org.apach
e.asn1.ber.digester.BERDigester@14a8cd1
> 29 [main] DEBUG BERDigester - Rule org.apache.ldap.common.berlib.asn1
.decoder.ErrorMessageRule@406199 fired successfully by digester org.apache.a
sn1.ber.digester.BERDigester@14a8cd1
> 31 [main] ERROR BERDigester - Error while triggering rule org.apache.
ldap.common.berlib.asn1.decoder.bind.BindResponseRule@c7b00c with digester o
rg.apache.asn1.ber.digester.BERDigester@14a8cd1: Rule.finish() threw excepti
on
> java.util.EmptyStackException
> at org.apache.commons.collections.ArrayStack.peek(ArrayStack.java:89)
> at org.apache.asn1.ber.digester.BERDigester.peek(BERDigester.java:279)
> at org.apache.ldap.common.berlib.asn1.decoder.bind.BindResponseRule.finis
h(BindResponseRule.java:58)
> at org.apache.asn1.ber.digester.BERDigester.fireFinishEvent(BERDigester.j
ava:1132)
> at org.apache.asn1.ber.digester.BERDigester$DigesterCallback.decodeOccurr
ed(BERDigester.java:196)
> at org.apache.asn1.ber.BERDecoder.fireDecodeOccurred(BERDecoder.java:401)
> at org.apache.asn1.ber.BERDecoder.updateStack(BERDecoder.java:462)
> at org.apache.asn1.ber.BERDecoder.decodeOccurred(BERDecoder.java:301)
> at org.apache.asn1.codec.stateful.AbstractStatefulDecoder.decodeOccurred(
AbstractStatefulDecoder.java:130)
> at org.apache.asn1.ber.LengthDecoder.decode(LengthDecoder.java:58)
> at org.apache.asn1.ber.BERDecoder.decode(BERDecoder.java:158)
> at org.apache.asn1.ber.digester.BERDigester.decode(BERDigester.java:141)
> at org.apache.ldap.common.berlib.asn1.SnickersDecoder.digest(SnickersDeco
der.java:187)
> at org.apache.ldap.common.berlib.asn1.SnickersDecoder.decode(SnickersDeco
der.java:135)
> at org.apache.ldap.common.message.MessageDecoder.decode(MessageDecoder.ja
va:107)
> at org.apache.ldap.clients.LdapBind.bind(LdapBind.java:354)
> at org.apache.ldap.clients.LdapSearch.main(LdapSearch.java:408)
> java.util.EmptyStackException
> at org.apache.commons.collections.ArrayStack.peek(ArrayStack.java:89)
> at org.apache.asn1.ber.digester.BERDigester.peek(BERDigester.java:279)
> at org.apache.ldap.common.berlib.asn1.decoder.bind.BindResponseRule.finis
h(BindResponseRule.java:58)
> at org.apache.asn1.ber.digester.BERDigester.fireFinishEvent(BERDigester.j
ava:1132)
> at org.apache.asn1.ber.digester.BERDigester$DigesterCallback.decodeOccurr
ed(BERDigester.java:196)
> at org.apache.asn1.ber.BERDecoder.fireDecodeOccurred(BERDecoder.java:401)
> at org.apache.asn1.ber.BERDecoder.updateStack(BERDecoder.java:462)
> at org.apache.asn1.ber.BERDecoder.decodeOccurred(BERDecoder.java:301)
> at org.apache.asn1.codec.stateful.AbstractStatefulDecoder.decodeOccurred(
AbstractStatefulDecoder.java:130)
> at org.apache.asn1.ber.LengthDecoder.decode(LengthDecoder.java:58)
> at org.apache.asn1.ber.BERDecoder.decode(BERDecoder.java:158)
> at org.apache.asn1.ber.digester.BERDigester.decode(BERDigester.java:141)
> at org.apache.ldap.common.berlib.asn1.SnickersDecoder.digest(SnickersDeco
der.java:187)
> at org.apache.ldap.common.berlib.asn1.SnickersDecoder.decode(SnickersDeco
der.java:135)
> at org.apache.ldap.common.message.MessageDecoder.decode(MessageDecoder.ja
va:107)
> at org.apache.ldap.clients.LdapBind.bind(LdapBind.java:354)
> at org.apache.ldap.clients.LdapSearch.main(LdapSearch.java:408)
> 34 [main] FATAL org.apache.ldap.clients.LdapBind - Failed to bind to
server due to message composition failure
> org.apache.ldap.common.message.spi.ProviderException: Snickers decoder fai
lure!
> at org.apache.ldap.common.berlib.asn1.SnickersDecoder.digest(SnickersDeco
der.java:193)
> at org.apache.ldap.common.berlib.asn1.SnickersDecoder.decode(SnickersDeco
der.java:135)
> at org.apache.ldap.common.message.MessageDecoder.decode(MessageDecoder.ja
va:107)
> at org.apache.ldap.clients.LdapBind.bind(LdapBind.java:354)
> at org.apache.ldap.clients.LdapSearch.main(LdapSearch.java:408)
> Nested exceptions to follow:
> <<========= Last Nested Exception ========>>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secur...nistrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[ Post a follow-up to this message ]
|