directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1041097 - in /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber: AbstractContainer.java Asn1Container.java Asn1Decoder.java grammar/AbstractGrammar.java
Date Wed, 01 Dec 2010 17:32:00 GMT
Author: elecharny
Date: Wed Dec  1 17:32:00 2010
New Revision: 1041097

URL: http://svn.apache.org/viewvc?rev=1041097&view=rev
Log:
Added a new flag in the Asn1Container to tell the Asn1Decoder to gather the incoming data
in the TLV Value when it's a constructed type

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Container.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java?rev=1041097&r1=1041096&r2=1041097&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java
Wed Dec  1 17:32:00 2010
@@ -69,6 +69,10 @@ public abstract class AbstractContainer 
 
     /** The Stream being decoded */
     private ByteBuffer stream;
+    
+    /** A flag telling if the Value should be accumulated before being decoded 
+     * for constructed types */ 
+    private boolean isGathering = false;
 
     /**
      * Creates a new instance of AbstractContainer with a starting state.
@@ -324,4 +328,23 @@ public abstract class AbstractContainer 
         
         this.parentTLV = parentTlv;
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isGathering()
+    {
+        return isGathering;
+    }
+    
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setGathering( boolean isGathering )
+    {
+        this.isGathering = isGathering;
+    }
+
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Container.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Container.java?rev=1041097&r1=1041096&r2=1041097&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Container.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Container.java
Wed Dec  1 17:32:00 2010
@@ -193,4 +193,20 @@ public interface Asn1Container
      * Look for the closest parent which has an expected length above 0
      */
     void updateParent();
+    
+    
+    /**
+     * @return true if the container should gather the value into itself, false
+     * if the decoding of the Value part should be done immediately for 
+     * constructed types.
+     */
+    boolean isGathering();
+    
+    
+    /**
+     * Set the isGathering flag
+     * @param isGathering true to ask the Asn1Decoder to gather the data
+     * into the container. If not set, the default value is 'false'
+     */
+    void setGathering( boolean isGathering );
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java?rev=1041097&r1=1041096&r2=1041097&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
Wed Dec  1 17:32:00 2010
@@ -508,7 +508,7 @@ public class Asn1Decoder implements TLVB
     {
         TLV currentTlv = container.getCurrentTLV();
 
-        if ( TLV.isConstructed( currentTlv.getTag() ) )
+        if ( TLV.isConstructed( currentTlv.getTag() ) && !container.isGathering()
)
         {
             container.setState( TLVStateEnum.TLV_STATE_DONE );
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java?rev=1041097&r1=1041096&r2=1041097&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java
Wed Dec  1 17:32:00 2010
@@ -24,6 +24,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.asn1.util.Asn1StringUtils;
 import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 



Mime
View raw message