Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0611617C00 for ; Sat, 7 Mar 2015 06:29:34 +0000 (UTC) Received: (qmail 54702 invoked by uid 500); 7 Mar 2015 06:29:34 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 54656 invoked by uid 500); 7 Mar 2015 06:29:34 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 54647 invoked by uid 99); 7 Mar 2015 06:29:34 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Mar 2015 06:29:34 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 95A94AC0B2E for ; Sat, 7 Mar 2015 06:29:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1664799 - in /directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl: StoreAssertionValue.java VirtualListViewRequestDecorator.java Date: Sat, 07 Mar 2015 06:29:34 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150307062934.95A94AC0B2E@hades.apache.org> Author: elecharny Date: Sat Mar 7 06:29:34 2015 New Revision: 1664799 URL: http://svn.apache.org/r1664799 Log: Many other fixes in the VLV codec implementation. tests are GOOD. Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/StoreAssertionValue.java directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestDecorator.java Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/StoreAssertionValue.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/StoreAssertionValue.java?rev=1664799&r1=1664798&r2=1664799&view=diff ============================================================================== --- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/StoreAssertionValue.java (original) +++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/StoreAssertionValue.java Sat Mar 7 06:29:34 2015 @@ -20,7 +20,9 @@ package org.apache.directory.api.ldap.extras.controls.vlv_impl; -import org.apache.directory.api.asn1.actions.AbstractReadOctetString; +import org.apache.directory.api.asn1.ber.grammar.GrammarAction; +import org.apache.directory.api.asn1.ber.tlv.TLV; +import org.apache.directory.api.util.Strings; /** @@ -28,7 +30,7 @@ import org.apache.directory.api.asn1.act * * @author Apache Directory Project */ -public class StoreAssertionValue extends AbstractReadOctetString +public class StoreAssertionValue extends GrammarAction { /** @@ -36,7 +38,7 @@ public class StoreAssertionValue extends */ public StoreAssertionValue() { - super( "VirtualListViewRequest offset" ); + super( "VirtualListViewRequest assertionValue" ); } @@ -44,9 +46,20 @@ public class StoreAssertionValue extends * {@inheritDoc} */ @Override - protected void setOctetString( byte[] value, VirtualListViewRequestContainer vlvContainer ) + public void action( VirtualListViewRequestContainer vlvContainer ) { - vlvContainer.getDecorator().setAssertionValue( value ); + TLV tlv = vlvContainer.getCurrentTLV(); + + if ( tlv.getLength() != 0 ) + { + byte[] assertionValue = tlv.getValue().getData(); + + vlvContainer.getDecorator().setAssertionValue( assertionValue ); + } + else + { + vlvContainer.getDecorator().setAssertionValue( Strings.EMPTY_BYTES ); + } // The last element is optional, we can quit here vlvContainer.setGrammarEndAllowed( true ); Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestDecorator.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestDecorator.java?rev=1664799&r1=1664798&r2=1664799&view=diff ============================================================================== --- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestDecorator.java (original) +++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestDecorator.java Sat Mar 7 06:29:34 2015 @@ -84,12 +84,14 @@ public class VirtualListViewRequestDecor if ( assertionValue != null ) { - vlvSeqLength += 1 + TLV.getNbBytes( assertionValue.length ) + assertionValue.length; + targetSeqLength = 1 + TLV.getNbBytes( assertionValue.length ) + assertionValue.length; } else { - vlvSeqLength += 1 + 1; + targetSeqLength = 1 + 1; } + + vlvSeqLength += targetSeqLength; } if ( getContextId() != null ) @@ -132,10 +134,19 @@ public class VirtualListViewRequestDecor else { buffer.put( ( byte ) VirtualListViewerTags.ASSERTION_VALUE_TAG.getValue() ); - buffer.put( TLV.getBytes( targetSeqLength ) ); + byte[] value = getAssertionValue(); + + if ( value != null ) + { + buffer.put( TLV.getBytes( value.length ) ); + } + else + { + buffer.put( TLV.getBytes( 0 ) ); + } - // The by assertionValue values - BerValue.encode( buffer, getAssertionValue() ); + // The by assertionValue value + buffer.put( value ); } if ( getContextId() != null ) @@ -290,7 +301,7 @@ public class VirtualListViewRequestDecor @Override public byte[] getAssertionValue() { - return null; + return getDecorated().getAssertionValue(); } @@ -300,6 +311,7 @@ public class VirtualListViewRequestDecor @Override public void setAssertionValue( byte[] assertionValue ) { + getDecorated().setAssertionValue( assertionValue ); }