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] Commented: (DIRLDAP-30) Digester throw an EmptyStackException even if result is OK
Date Sun, 13 Feb 2005 16:23:12 GMT
     [ http://issues.apache.org/jira/browse/DIRLDAP-30?page=comments#action_59112 ]
     
Emmanuel Lecharny commented on DIRLDAP-30:
------------------------------------------

I think that the problem lies in org.apache.ldap.common.berlib.asn1.decoder.bind.BindResponseRule.java
class. The finish method looks for an optionnal ServerSaslCreds. But as it's optionnal, and
as it's the last TLV of the LdapMessage, the peek fails (EmptyStackException) :

...
    public void finish()
    {
        super.finish() ;

        if ( getDigester().peek() instanceof ByteBuffer )  <-- Empty stack Exception !
...

The code should be something like this, I bet :
...

    public void finish()
    {
        super.finish() ;

        if ( (getDigester().getCount() != 0) &&  ( getDigester().peek() instanceof
ByteBuffer ) )
...


(svn diff attached)

> 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
>  Attachments: BindResponseRule.diff
>
> 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


Mime
View raw message