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 <el...@iktek.com> on 2005/02/01 10:15:13 UTC

Re: [jira] Commented: (DIRLDAP-30) Digester throw an EmptyStackException even if result is OK

It's not bad code. Actually, I must say that, even if it's not very
simple to dive in, it is the kind of code I like to read :
- clear,
- commented
- well written

So, I'm just trying to get a grip on the whole project, and LdapClient
functions seem to be a good start. At least, it helped me to refresh my
memory about those old PDUs and ASN.1 syntax !



Le mardi 01 février 2005 à 01:43 +0100, Alex Karasulu (JIRA) a écrit :
>      [ http://issues.apache.org/jira/browse/DIRLDAP-30?page=comments#action_58346 ]
>      
> Alex Karasulu commented on DIRLDAP-30:
> --------------------------------------
> 
> Hmmmm I don't know what's going on to make this happen.  I have not played with it yet.  However yes digester is a maze and it's garbage that has to go.  If you like we can start working on revamping her together rather than focusing on these minor issues.  I hate the fact that you're burning cycles on learning about crap code that will go away.
> 
> I appologize for any inconvenience the bad code I wrote is causing you.  I think we can make it way better.  Keep in mind this is the first attempt at trying to make an ASN.1 BER/DER runtime work.  Before this we had snacc4j based code.  
> 
> -Alex
> 
> 
> > Digester throw an EmptyStackException even if result is OK
> > ----------------------------------------------------------
> >
> >          Key: DIRLDAP-30
> >          URL: http://issues.apache.org/jira/browse/DIRLDAP-30
> >      Project: Directory LDAP
> >         Type: Bug
> >   Components: Snickers Codec Provider
> >  Environment: Not relevant
> >     Reporter: Emmanuel Lecharny
> >     Assignee: Alex Karasulu
> >     Priority: Blocker
> 
> >
> > Binding to the Ldap database (OpenLdap), I get a correct answer :  
> > 30 0c --> Bind Result, 12 bytes long
> > 02 01 01 --> Message ID = 1
> > 61 07 --> Bind Result, length = 7
> > 0a 01 00 --> Result code = Success
> > 04 00 --> no matched DN
> > 04 00 --> no error message
> > But I got a full pack of stack trace from Digester. It seems that if the stack is empty, it does not work. Does Digester able to handle zero length value TLV ? (here, the last two TLV are TL = {04 00} and TL = {04 00}, as they have L=0, so V does not exist).
> > Here is the trace and the stack.
> > (Man, digester is a maze !)
> > 0 [main] DEBUG org.apache.ldap.common.berlib.asn1.SnickersDecoder  - Read 14 bytes :
> > 2 [main] DEBUG org.apache.ldap.common.berlib.asn1.SnickersDecoder  - [30 0c 02 01 01 61 07 0a 01 00 04 00 04 00]
> > 3 [main] DEBUG BERDigester  - Rule org.apache.asn1.ber.digester.rules.PrimitiveIntDecodeRule@10f11b8 fired successfully by digester org.apache.asn1.ber.digester.BERDigester@544ec1
> > 33 [main] DEBUG BERDigester  - Rule org.apache.ldap.common.berlib.asn1.decoder.ResultMatchedDNRule@cfec48 fired successfully by digester org.apache.asn1.ber.digester.BERDigester@544ec1
> > 34 [main] DEBUG BERDigester  - Rule org.apache.ldap.common.berlib.asn1.decoder.ErrorMessageRule@a17083 fired successfully by digester org.apache.asn1.ber.digester.BERDigester@544ec1
> > 34 [main] DEBUG BERDigester  - Rule org.apache.ldap.common.berlib.asn1.decoder.ResultMatchedDNRule@cfec48 fired successfully by digester org.apache.asn1.ber.digester.BERDigester@544ec1
> > 34 [main] DEBUG BERDigester  - Rule org.apache.ldap.common.berlib.asn1.decoder.ErrorMessageRule@a17083 fired successfully by digester org.apache.asn1.ber.digester.BERDigester@544ec1
> > 36 [main] ERROR BERDigester  - Error while triggering rule 
> > org.apache.ldap.common.berlib.asn1.decoder.bind.BindResponseRule@e1d5ea with digester 
> > org.apache.asn1.ber.digester.BERDigester@544ec1: 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:355)
> > 	at org.apache.asn1.ber.BERDecoder.updateStack(BERDecoder.java:404)
> > 	at org.apache.asn1.ber.BERDecoder.decodeOccurred(BERDecoder.java:279)
> > 	at org.apache.asn1.codec.stateful.AbstractStatefulDecoder.decodeOccurred(AbstractStatefulDecoder.java:119)
> > 	at org.apache.asn1.ber.LengthDecoder.decode(LengthDecoder.java:53)
> > 	at org.apache.asn1.ber.BERDecoder.decode(BERDecoder.java:152)
> > 	at org.apache.asn1.ber.digester.BERDigester.decode(BERDigester.java:141)
> > 	at org.apache.ldap.common.berlib.asn1.SnickersDecoder.digest(SnickersDecoder.java:179)
> > 	at org.apache.ldap.common.berlib.asn1.SnickersDecoder.decode(SnickersDecoder.java:125)
> > 	at org.apache.ldap.common.message.MessageDecoder.decode(MessageDecoder.java:106)
> > 	at org.apache.ldap.clients.LdapBind.bind(LdapBind.java:342)
> > 	at org.apache.ldap.clients.LdapBind.main(LdapBind.java:401)
> > 36 [main] ERROR BERDigester  - Error while triggering rule org.apache.ldap.common.berlib.asn1.decoder.bind.BindResponseRule@e1d5ea with digester org.apache.asn1.ber.digester.BERDigester@544ec1: 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:355)
> > 	at org.apache.asn1.ber.BERDecoder.updateStack(BERDecoder.java:404)
> > 	at org.apache.asn1.ber.BERDecoder.decodeOccurred(BERDecoder.java:279)
> > 	at org.apache.asn1.codec.stateful.AbstractStatefulDecoder.decodeOccurred(AbstractStatefulDecoder.java:119)
> > 	at org.apache.asn1.ber.LengthDecoder.decode(LengthDecoder.java:53)
> > 	at org.apache.asn1.ber.BERDecoder.decode(BERDecoder.java:152)
> > 	at org.apache.asn1.ber.digester.BERDigester.decode(BERDigester.java:141)
> > 	at org.apache.ldap.common.berlib.asn1.SnickersDecoder.digest(SnickersDecoder.java:179)
> > 	at org.apache.ldap.common.berlib.asn1.SnickersDecoder.decode(SnickersDecoder.java:125)
> > 	at org.apache.ldap.common.message.MessageDecoder.decode(MessageDecoder.java:106)
> > 	at org.apache.ldap.clients.LdapBind.bind(LdapBind.java:342)
> > 	at org.apache.ldap.clients.LdapBind.main(LdapBind.java:401)
> > Exception in thread "main" org.apache.ldap.common.message.spi.ProviderException: Snickers decoder failure!
> > 	at org.apache.ldap.common.berlib.asn1.SnickersDecoder.digest(SnickersDecoder.java:183)
> > 	at org.apache.ldap.common.berlib.asn1.SnickersDecoder.decode(SnickersDecoder.java:125)
> > 	at org.apache.ldap.common.message.MessageDecoder.decode(MessageDecoder.java:106)
> > 	at org.apache.ldap.clients.LdapBind.bind(LdapBind.java:342)
> > 	at org.apache.ldap.clients.LdapBind.main(LdapBind.java:401)
> > Nested exceptions to follow:
> > 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:355)
> > 	at org.apache.asn1.ber.BERDecoder.updateStack(BERDecoder.java:404)
> > 	at org.apache.asn1.ber.BERDecoder.decodeOccurred(BERDecoder.java:279)
> > 	at org.apache.asn1.codec.stateful.AbstractStatefulDecoder.decodeOccurred(AbstractStatefulDecoder.java:119)
> > 	at org.apache.asn1.ber.LengthDecoder.decode(LengthDecoder.java:53)
> > 	at org.apache.asn1.ber.BERDecoder.decode(BERDecoder.java:152)
> > 	at org.apache.asn1.ber.digester.BERDigester.decode(BERDigester.java:141)
> > 	at org.apache.ldap.common.berlib.asn1.SnickersDecoder.digest(SnickersDecoder.java:179)
> > 	at org.apache.ldap.common.berlib.asn1.SnickersDecoder.decode(SnickersDecoder.java:125)
> > 	at org.apache.ldap.common.message.MessageDecoder.decode(MessageDecoder.java:106)
> > 	at org.apache.ldap.clients.LdapBind.bind(LdapBind.java:342)
> > 	at org.apache.ldap.clients.LdapBind.main(LdapBind.java:401)
> > 	<<========= 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
> -
> If you want more information on JIRA, or have a bug to report see:
>    http://www.atlassian.com/software/jira
> 
>