Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 10700 invoked from network); 24 Jun 2006 13:56:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 Jun 2006 13:56:02 -0000 Received: (qmail 98347 invoked by uid 500); 24 Jun 2006 13:56:01 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 98310 invoked by uid 500); 24 Jun 2006 13:56:00 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 98299 invoked by uid 99); 24 Jun 2006 13:56:00 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 24 Jun 2006 06:56:00 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 24 Jun 2006 06:56:00 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C803B7141F0 for ; Sat, 24 Jun 2006 13:54:30 +0000 (GMT) Message-ID: <8079653.1151157270816.JavaMail.jira@brutus> Date: Sat, 24 Jun 2006 13:54:30 +0000 (GMT+00:00) From: "Emmanuel Lecharny (JIRA)" To: dev@directory.apache.org Subject: [jira] Closed: (DIRSERVER-212) Class SnickersEncoder does not send data with a WritableByteChannel on Linux MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DIRSERVER-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 Linux > ---------------------------------------------------------------------------- > > 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 encodeOccurred 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 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 by 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 experienced with NIO (the hendrix way of being experienced...), but I'll tried to improve my knowledge by browsing Sun code, just to check. Didn't had time to test it unde M$, but 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.PrimitiveIntDecodeRule@d19bc8 fired successfully by digester org.apache.asn1.ber.digester.BERDigester@14a8cd1 > 29 [main] DEBUG BERDigester - Rule org.apache.ldap.common.berlib.asn1.decoder.ResultMatchedDNRule@2a4983 fired successfully by digester org.apache.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.asn1.ber.digester.BERDigester@14a8cd1 > 29 [main] DEBUG BERDigester - Rule org.apache.ldap.common.berlib.asn1.decoder.ResultMatchedDNRule@2a4983 fired successfully by digester org.apache.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.asn1.ber.digester.BERDigester@14a8cd1 > 31 [main] ERROR BERDigester - Error while triggering rule org.apache.ldap.common.berlib.asn1.decoder.bind.BindResponseRule@c7b00c with digester org.apache.asn1.ber.digester.BERDigester@14a8cd1: Rule.finish() threw exception > 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.finish(BindResponseRule.java:58) > at org.apache.asn1.ber.digester.BERDigester.fireFinishEvent(BERDigester.java:1132) > at org.apache.asn1.ber.digester.BERDigester$DigesterCallback.decodeOccurred(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(SnickersDecoder.java:187) > at org.apache.ldap.common.berlib.asn1.SnickersDecoder.decode(SnickersDecoder.java:135) > at org.apache.ldap.common.message.MessageDecoder.decode(MessageDecoder.java: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.finish(BindResponseRule.java:58) > at org.apache.asn1.ber.digester.BERDigester.fireFinishEvent(BERDigester.java:1132) > at org.apache.asn1.ber.digester.BERDigester$DigesterCallback.decodeOccurred(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(SnickersDecoder.java:187) > at org.apache.ldap.common.berlib.asn1.SnickersDecoder.decode(SnickersDecoder.java:135) > at org.apache.ldap.common.message.MessageDecoder.decode(MessageDecoder.java: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 failure! > at org.apache.ldap.common.berlib.asn1.SnickersDecoder.digest(SnickersDecoder.java:193) > at org.apache.ldap.common.berlib.asn1.SnickersDecoder.decode(SnickersDecoder.java:135) > at org.apache.ldap.common.message.MessageDecoder.decode(MessageDecoder.java: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/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira