You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Alex Karasulu <ao...@bellsouth.net> on 2005/03/07 23:14:36 UTC
Re: svn commit: r155926 [1/2] - in incubator/directory/asn1/trunk:
ber/src/java/org/apache/asn1/ber/ ber/src/java/org/apache/asn1/ber/digester/rules/
ber/src/test/org/apache/asn1/ber/ ber/src/test/org/apache/asn1/ber/digester/rules/
ber/xdocs/ codec/src/java/org/apache/asn1/codec/stateful/ xdocs/
Again I can't tell if this is a reformat only or if critical changes are
being made.
-Alex
adc@apache.org wrote:
>Author: adc
>Date: Wed Mar 2 07:14:39 2005
>New Revision: 155926
>
>URL: http://svn.apache.org/viewcvs?view=rev&rev=155926
>Log:
>Unable to indefinitely wait on this particular fix.
>
>Modified:
> incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/BERDecoder.java
> incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/BEREncoder.java
> incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/DefaultMutableTupleNode.java
> incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/DeterminateLengthVisitor.java
> incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/Length.java
> incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/Tuple.java
> incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TupleEncodingVisitor.java
> incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TupleTreeAnalyzer.java
> incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/digester/rules/PrimitiveOctetStringRule.java
> incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/BERDecoderTest.java
> incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/BEREncoderTest.java
> incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/ConstructedTLVTests.java
> incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/DefaultMutableTupleNodeTest.java
> incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/TupleTest.java
> incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/digester/rules/PrimitiveOctetStringRuleTest.java
> incubator/directory/asn1/trunk/ber/xdocs/BERDecoderDesign.xml
> incubator/directory/asn1/trunk/codec/src/java/org/apache/asn1/codec/stateful/CallbackHistory.java
> incubator/directory/asn1/trunk/xdocs/refactor.xml
>
>Modified: incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/BERDecoder.java
>URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/BERDecoder.java?view=diff&r1=155925&r2=155926
>==============================================================================
>--- incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/BERDecoder.java (original)
>+++ incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/BERDecoder.java Wed Mar 2 07:14:39 2005
>@@ -1,5 +1,5 @@
> /*
>- * Copyright 2004 The Apache Software Foundation
>+ * Copyright 2004-2005 The Apache Software Foundation
> *
> * Licensed under the Apache License, Version 2.0 (the "License");
> * you may not use this file except in compliance with the License.
>@@ -29,34 +29,34 @@
>
>
> /**
>- * A decoder that decodes BER encoded bytes to Tag Value Length (TLV) tuples.
>- * This decoder is a low level event based parser which operates in a fashion
>- * similar to the way SAX works except the elements of concern are the tag,
>+ * A decoder that decodes BER encoded bytes to Tag Value Length (TLV) tuples.
>+ * This decoder is a low level event based parser which operates in a fashion
>+ * similar to the way SAX works except the elements of concern are the tag,
> * length, and value entities. The decoder is a state machine which processes
> * input as it is made available.
> * <p>
>- * A Stack is used to track the state of the decoder between decode calls. It
>- * maintains the nesting of TLV tuples. Rather than creating new TLV tuple
>- * instances every time a single tuple is reused for primitive types and new
>+ * A Stack is used to track the state of the decoder between decode calls. It
>+ * maintains the nesting of TLV tuples. Rather than creating new TLV tuple
>+ * instances every time a single tuple is reused for primitive types and new
> * tlv tuples are cloned for constructed types which are pushed onto the stack.
>- * The tuple fed to the callback must therefore be used very carefully - its
>- * values must be copied to prevent their loss if they are to be used later
>+ * The tuple fed to the callback must therefore be used very carefully - its
>+ * values must be copied to prevent their loss if they are to be used later
> * after the callback invokation has returned.
> * </p>
> * <p>
> * Note that all tuples are not created equal. Constructed TLVs nesting others
>- * will have null value members or empty buffers. Only TLV tuples of primitive
>- * types or the leaf TLV tuples of the TLV tuple tree will contain non null
>- * values. Therefore the nature of a TLV tuple should be investigated by
>+ * will have null value members or empty buffers. Only TLV tuples of primitive
>+ * types or the leaf TLV tuples of the TLV tuple tree will contain non null
>+ * values. Therefore the nature of a TLV tuple should be investigated by
> * callbacks before attempting to interpret their values. Also this decoder
> * chunks value data returning it in parts rather than in one complete peice
> * in the end. The value of the TLV Tuple returned is the part of the value
> * that was read from the input fed into the decoder. These 'chunks' returned
> * by callback makes it so there are no size limits to the value of a TLV. Again
>- * to reiterate chunking on values is only performed on primitive TLV Tuple
>- * types.
>+ * to reiterate chunking on values is only performed on primitive TLV Tuple
>+ * types.
> * </p>
>- *
>+ *
> * @author <a href="mailto:directory-dev@incubator.apache.org">
> * Apache Directory Project</a>
> * @version $Rev$
>@@ -64,35 +64,35 @@
> public class BERDecoder implements StatefulDecoder, DecoderCallback
> {
> /** empty byte buffer to be reused */
>- private static final ByteBuffer EMPTY_BUFFER =
>+ private static final ByteBuffer EMPTY_BUFFER =
> ByteBuffer.wrap( ArrayUtils.EMPTY_BYTE_ARRAY ) ;
> /** the callback used by this decoder */
>- private static final BERDecoderCallback DEFAULT_CALLBACK =
>+ private static final BERDecoderCallback DEFAULT_CALLBACK =
> new BERDecoderCallbackAdapter() ;
> /** the monitor used by this decoder */
> private static final DecoderMonitor DEFAULT_MONITOR =
> new DecoderMonitorAdapter() ;
>-
>+
> /** this decoder's callback */
> private BERDecoderCallback cb = DEFAULT_CALLBACK ;
> /** the monitor used by this decoder */
> private DecoderMonitor monitor = DEFAULT_MONITOR ;
>-
>+
> /** the single TLV tuple used by this decoder */
> private final Tuple tlv = new Tuple() ;
>
>- /** a decoder used to decode tag octets */
>+ /** a decoder used to decode tag octets */
> private final TagDecoder tagDecoder = new TagDecoder() ;
>- /** a decoder used to decode length octets */
>+ /** a decoder used to decode length octets */
> private final LengthDecoder lengthDecoder = new LengthDecoder() ;
>-
>+
> /** stack of nested/constructed TLV tuples */
> private final Stack tlvStack = new Stack() ;
>
> /** the state of this decoder */
> private BERDecoderState state = BERDecoderState.getStartState() ;
>-
>-
>+
>+
> /**
> * Creates a stateful BER decoder which limits the tuple's value size.
> */
>@@ -101,16 +101,16 @@
> tagDecoder.setCallback( this ) ;
> lengthDecoder.setCallback( this ) ;
> }
>-
>-
>+
>+
> // ------------------------------------------------------------------------
> // StatefulDecoder Methods
> // ------------------------------------------------------------------------
>
>-
>+
> /**
> * Expects a ByteBuffer containing BER encoded data.
>- *
>+ *
> * @see org.apache.asn1.codec.stateful.StatefulDecoder#decode(
> * java.lang.Object)
> * @throws ClassCastException if the encoded argument is not a ByteBuffer
>@@ -119,11 +119,11 @@
> public void decode( Object encoded ) throws DecoderException
> {
> ByteBuffer buf = ( ByteBuffer ) encoded ;
>-
>+
> /* --------------------------------------------------------------------
>- Handle any unusual input by informing the monitor.
>+ Handle any unusual input by informing the monitor.
> ------------------------------------------------------------------ */
>-
>+
> if ( buf == null && monitor != null )
> {
> String msg = "ignoring null argument to decode()" ;
>@@ -137,16 +137,16 @@
> monitor.warning( this, new IllegalArgumentException( msg ) ) ;
> return ;
> }
>-
>+
> /*
> * This loop is used instead of costly recursion. This requires each
> * of the statewise decode methods to process bytes from the buffer. If
>- * they can process enough to switch state they do and return
>- * immediately. This loop makes sure the next processing state is
>+ * they can process enough to switch state they do and return
>+ * immediately. This loop makes sure the next processing state is
> * handled if there is more data for that state.
> */
> while ( buf.hasRemaining() )
>- {
>+ {
> switch( state.getValue() )
> {
> case( BERDecoderState.TAG_VAL ):
>@@ -161,7 +161,7 @@
> }
> }
> }
>-
>+
>
> /* (non-Javadoc)
> * @see org.apache.asn1.codec.stateful.StatefulDecoder#setCallback(
>@@ -181,17 +181,17 @@
> {
> this.monitor = monitor ;
> }
>-
>-
>+
>+
> // ------------------------------------------------------------------------
> // State Based Decode Methods
> // ------------------------------------------------------------------------
>-
>-
>+
>+
> /**
> * Extracts the value portion from the buffer for a primitive type.
>- *
>- * @param buf the byte byffer containing BER encoded data
>+ *
>+ * @param buf the byte byffer containing BER encoded data
> */
> private void decodeValue( ByteBuffer buf )
> {
>@@ -210,9 +210,9 @@
> {
> needToRead = tlv.length - tlv.valueIndex ;
> }
>-
>+
> /*
>- * check if we have the remainder of the value to complete the
>+ * check if we have the remainder of the value to complete the
> * TLV within the current buffer - if so we read all of it
> */
> if ( buf.remaining() >= needToRead )
>@@ -221,14 +221,14 @@
> buf.position( buf.position() + needToRead ) ;
> tlv.valueIndex = tlv.length ;
> tlv.index += tlv.length ;
>-
>+
> cb.partialValueDecoded( tlv ) ;
> fireDecodeOccurred( tlv ) ;
> updateStack( needToRead ) ;
> tlv.clear() ;
> state = BERDecoderState.TAG ;
> }
>-
>+
> /*
> * the buffer does not contain the rest of the value we need in order
> * to complete the current TLV - the value is fragmented so we read
>@@ -240,20 +240,20 @@
> {
> tlv.valueIndex = 0 ;
> }
>-
>+
> int remaining = buf.remaining() ;
> tlv.valueChunk = buf.slice() ;
> buf.position( buf.limit() ) ;
> tlv.valueIndex += remaining ;
> tlv.index +=remaining ;
>-
>+
> cb.partialValueDecoded( tlv ) ;
> updateStack( remaining ) ;
> }
> }
>-
>-
>-
>+
>+
>+
> /* (non-Javadoc)
> * @see org.apache.asn1.codec.stateful.DecoderCallback#decodeOccurred(
> * org.apache.asn1.codec.stateful.StatefulDecoder, java.lang.Object)
>@@ -269,7 +269,7 @@
> tlv.typeClass = tag.getTypeClass() ;
> tlv.index = tag.size() ;
>
>- if ( ! tlv.isIndefinateTerminator() )
>+ if ( ! tlv.isIndefiniteTerminator() )
> {
> fireTagDecoded() ;
> updateStack( tag.size() ) ;
>@@ -281,27 +281,27 @@
> {
> Length length = ( Length ) decoded ;
> tlv.length = length.getLength() ;
>-
>- if ( tlv.length == Length.INDEFINATE )
>+
>+ if ( tlv.length == Length.INDEFINITE )
> {
>- tlv.index = Length.INDEFINATE ;
>- tlv.valueIndex = Length.INDEFINATE ;
>+ tlv.index = Length.INDEFINITE ;
>+ tlv.valueIndex = Length.INDEFINITE ;
> }
> else
>- {
>+ {
> tlv.index += length.size() ;
> }
>
>- if ( ! tlv.isIndefinateTerminator() )
>+ if ( ! tlv.isIndefiniteTerminator() )
> {
> fireLengthDecoded() ;
> }
> updateStack( length.size() ) ;
>-
>+
> if ( ! tlv.isPrimitive )
> {
>- if ( tlv.isIndefinate() || tlv.length > 0 )
>- {
>+ if ( tlv.isIndefinite() || tlv.length > 0 )
>+ {
> tlvStack.push( tlv.clone() ) ;
> }
> else
>@@ -309,11 +309,11 @@
> state = BERDecoderState.VALUE ;
> fireDecodeOccurred( tlv ) ;
> }
>-
>+
> state = BERDecoderState.TAG ;
> tlv.clear() ;
> }
>- else if ( tlv.isIndefinateTerminator() )
>+ else if ( tlv.isIndefiniteTerminator() )
> {
> return ;
> }
>@@ -335,20 +335,20 @@
> throw new IllegalArgumentException( "unrecognized decoder" ) ;
> }
> }
>-
>-
>+
>+
> // ------------------------------------------------------------------------
> // private utility methods
> // ------------------------------------------------------------------------
>-
>-
>+
>+
> /**
>- * Fires a tag decoded event by making the appropriate calls to the
>+ * Fires a tag decoded event by making the appropriate calls to the
> * callback and the monitor. If the monitor is a BERDecoderMonitor with
> * extended reporting, then those methods are invoked.
>- *
>- * Also as a side-effect this method clears the tag buffer once it has
>- * finished notifying the monitor and calling the callback.
>+ *
>+ * Also as a side-effect this method clears the tag buffer once it has
>+ * finished notifying the monitor and calling the callback.
> */
> private void fireTagDecoded()
> {
>@@ -363,15 +363,15 @@
> berMonitor.tagDecoded( tlv ) ;
> }
> }
>-
>-
>+
>+
> /**
>- * Fires a length decoded event by making the appropriate calls to the
>+ * Fires a length decoded event by making the appropriate calls to the
> * callback and the monitor. If the monitor is a BERDecoderMonitor with
> * extended reporting, then those methods are invoked.
>- *
>- * Also as a side-effect this method clears the length buffer once it has
>- * finished notifying the monitor and calling the callback.
>+ *
>+ * Also as a side-effect this method clears the length buffer once it has
>+ * finished notifying the monitor and calling the callback.
> */
> private void fireLengthDecoded()
> {
>@@ -379,17 +379,17 @@
> {
> cb.lengthDecoded( tlv ) ;
> }
>-
>+
> if ( monitor != null && monitor instanceof BERDecoderMonitor )
> {
> BERDecoderMonitor berMonitor = ( BERDecoderMonitor ) monitor ;
> berMonitor.lengthDecoded( tlv ) ;
> }
> }
>-
>-
>+
>+
> /**
>- * Fires a complete TLV decoded event by making the appropriate calls to
>+ * Fires a complete TLV decoded event by making the appropriate calls to
> * the callback and the monitor.
> */
> private void fireDecodeOccurred( Tuple tlv )
>@@ -398,17 +398,17 @@
> {
> cb.decodeOccurred( this, tlv ) ;
> }
>-
>+
> if ( monitor != null )
> {
> monitor.callbackOccured( this, cb, tlv ) ;
> }
> }
>
>-
>+
> /**
> * Increments the indices of constructed TLV's within the TLV Stack.
>- *
>+ *
> * @param increment the amount to increment indices by.
> */
> private void updateStack( int increment )
>@@ -416,32 +416,32 @@
> for ( int ii = 0; ii < tlvStack.size(); ii++ )
> {
> Tuple t = ( Tuple ) tlvStack.get( ii ) ;
>-
>- if ( t.isIndefinate() )
>+
>+ if ( t.isIndefinite() )
> {
> continue ;
> }
>-
>+
> t.index += increment ;
>-
>+
> if ( t.valueIndex == Length.UNDEFINED )
> {
> t.valueIndex = 0 ;
> }
>-
>+
> t.valueIndex += increment ;
> }
>-
>+
> if ( tlvStack.isEmpty() )
> {
> return ;
> }
>-
>+
> do
> {
> Tuple top = ( Tuple ) tlvStack.peek() ;
>-
>- if ( top.isIndefinate() && tlv.isIndefinateTerminator() )
>+
>+ if ( top.isIndefinite() && tlv.isIndefiniteTerminator() )
> {
> tlvStack.pop() ;
> state = BERDecoderState.VALUE ;
>@@ -449,7 +449,7 @@
> state = BERDecoderState.TAG ;
> break;
> }
>- else if ( top.isIndefinate() )
>+ else if ( top.isIndefinite() )
> {
> break ;
> }
>@@ -464,78 +464,78 @@
> {
> break ;
> }
>-
>+
> } while( tlvStack.size() > 0 ) ;
> }
>
>
> /*
>-
>+
> Why copy the raw tag here when we can maintain our own stack in the
> digester that does the pushing and popping instead? Keep this here
> until we decide what to do.
>-
>+
> public int[] getTagNestingPattern()
> {
> int stackSz = tlvStack.size() ;
> int[] pattern = new int[stackSz+1] ;
> pattern[stackSz] = tlv.rawTag ;
>-
>+
> for ( int ii = 0; ii < stackSz; ii++ )
> {
> pattern[ii] = ( ( Tuple ) tlvStack.get( ii ) ).rawTag ;
> }
>-
>+
> return pattern ;
> }
> */
>-
>-
>+
>+
> // ------------------------------------------------------------------------
> // Methods used for testing
> // ------------------------------------------------------------------------
>-
>-
>+
>+
> /**
>- * Gets the current state of this BERDecoder. Used only for debugging and
>+ * Gets the current state of this BERDecoder. Used only for debugging and
> * testing.
>- *
>+ *
> * @return the state enum
> */
> BERDecoderState getState()
> {
> return state ;
> }
>-
>-
>+
>+
> /**
>- * Gets a cloned copy of the current tuple. Used only for debugging and
>+ * Gets a cloned copy of the current tuple. Used only for debugging and
> * testing.
>- *
>- * @return a clone of the current tlv
>+ *
>+ * @return a clone of the current tlv
> */
> Tuple getCurrentTuple()
> {
> return ( Tuple ) tlv.clone() ;
> }
>-
>-
>+
>+
> /**
> * Gets a deep copy of the constructed tuple stack. Used only for debugging
> * and testing.
>- *
>+ *
> * @return a deep copy of the tuple stack
> */
> Stack getTupleStack()
> {
> Stack stack = new Stack() ;
>-
>+
> for ( int ii = 0; ii < tlvStack.size(); ii++ )
> {
> Tuple t = ( Tuple ) tlvStack.get( ii ) ;
> stack.add( t.clone() ) ;
> }
>-
>+
> return stack ;
> }
> }
>
>Modified: incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/BEREncoder.java
>URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/BEREncoder.java?view=diff&r1=155925&r2=155926
>==============================================================================
>--- incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/BEREncoder.java (original)
>+++ incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/BEREncoder.java Wed Mar 2 07:14:39 2005
>@@ -1,5 +1,5 @@
> /*
>- * Copyright 2004 The Apache Software Foundation
>+ * Copyright 2004-2005 The Apache Software Foundation
> *
> * Licensed under the Apache License, Version 2.0 (the "License");
> * you may not use this file except in compliance with the License.
>@@ -157,7 +157,7 @@
> * streams from objects. This method simply returns if the object is
> * a primitive Tuple because all value processing has already occurred
> * for that tuple. If on the otherhand the tuple is constructed and of
>- * the indefinate form need to write the termination sequence (two
>+ * the indefinite form need to write the termination sequence (two
> * zeros) down into the stream. We attempt to do this into the buffer.
> * If the buffer is full we flush is with an encodeOccurred() event.
> * Then we write the termination sequence into the buffer and flush
>@@ -170,7 +170,7 @@
> return;
> }
>
>- if ( tlv.isIndefinate() )
>+ if ( tlv.isIndefinite() )
> {
> if ( buf.remaining() < 2 )
> {
>
>Modified: incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/DefaultMutableTupleNode.java
>URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/DefaultMutableTupleNode.java?view=diff&r1=155925&r2=155926
>==============================================================================
>--- incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/DefaultMutableTupleNode.java (original)
>+++ incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/DefaultMutableTupleNode.java Wed Mar 2 07:14:39 2005
>@@ -1,5 +1,5 @@
> /*
>- * Copyright 2004 The Apache Software Foundation
>+ * Copyright 2004-2005 The Apache Software Foundation
> *
> * Licensed under the Apache License, Version 2.0 (the "License");
> * you may not use this file except in compliance with the License.
>@@ -44,21 +44,21 @@
> private DefaultMutableTupleNode parent ;
> /** this node's accumulated ByteBuffer value chunks */
> private List valueChunks = new ArrayList( 2 ) ;
>-
>-
>+
>+
> /**
> * Creates a node without a parent and without a tuple.
> */
> public DefaultMutableTupleNode()
> {
> }
>-
>+
>
> /**
> * Creates a node without a parent using a tuple. If the tuple is primitive
> * and has a non-null last value chunk, that value chunk is added to the
> * list of value chunks.
>- *
>+ *
> * @param tuple the tuple to set for this node
> */
> public DefaultMutableTupleNode( Tuple tuple )
>@@ -70,11 +70,11 @@
> valueChunks.add( tuple.getLastValueChunk() );
> }
> }
>-
>+
>
> /**
> * Creates a node without a parent.
>- *
>+ *
> * @param tuple the tuple to set for this node
> */
> public DefaultMutableTupleNode( Tuple tuple, List valueChunks )
>@@ -82,7 +82,7 @@
> this.tuple = tuple ;
> this.valueChunks.addAll( valueChunks ) ;
> }
>-
>+
>
> /* (non-Javadoc)
> * @see org.apache.asn1.ber.MutableTupleNode#insert(
>@@ -90,14 +90,14 @@
> */
> public void insert( MutableTupleNode child, int index )
> {
>- children.add( index, child ) ;
>+ children.add( index, child ) ;
> }
>-
>-
>+
>+
> /**
> * Adds a child node to the front of the child list.
>- *
>- * @param child the child to add to the front
>+ *
>+ * @param child the child to add to the front
> */
> public void addFront( DefaultMutableTupleNode child )
> {
>@@ -105,24 +105,24 @@
> {
> children.add( child ) ;
> }
>- else
>+ else
> {
> children.add( 0, child ) ;
> }
> }
>
>-
>+
> /**
> * Adds a child node to the end of the child list.
>- *
>- * @param child the child to add to the end
>+ *
>+ * @param child the child to add to the end
> */
> public void addLast( DefaultMutableTupleNode child )
> {
> children.add( child ) ;
> }
>-
>-
>+
>+
> /* (non-Javadoc)
> * @see org.apache.asn1.ber.MutableTupleNode#remove(int)
> */
>@@ -131,7 +131,7 @@
> children.remove( index ) ;
> }
>
>-
>+
> /* (non-Javadoc)
> * @see org.apache.asn1.ber.MutableTupleNode#remove(
> * org.apache.asn1.ber.MutableTupleNode)
>@@ -140,7 +140,7 @@
> {
> children.remove( node ) ;
> }
>-
>+
>
> /* (non-Javadoc)
> * @see org.apache.asn1.ber.MutableTupleNode#removeFromParent()
>@@ -151,7 +151,7 @@
> parent = null ;
> }
>
>-
>+
> /* (non-Javadoc)
> * @see org.apache.asn1.ber.MutableTupleNode#setParent(
> * org.apache.asn1.ber.MutableTupleNode)
>@@ -159,14 +159,14 @@
> public void setParent( MutableTupleNode newParent )
> {
> if ( parent != null )
>- {
>+ {
> parent.remove( this ) ;
> }
>-
>+
> parent = ( DefaultMutableTupleNode ) newParent ;
> }
>
>-
>+
> /* (non-Javadoc)
> * @see org.apache.asn1.ber.TupleNode#getParent()
> */
>@@ -174,7 +174,7 @@
> {
> return parent ;
> }
>-
>+
>
> /* (non-Javadoc)
> * @see org.apache.asn1.ber.TupleNode#children()
>@@ -184,7 +184,7 @@
> return Collections.unmodifiableList( children ).iterator() ;
> }
>
>-
>+
> /* (non-Javadoc)
> * @see org.apache.asn1.ber.TupleNode#getChildAt()
> */
>@@ -193,7 +193,7 @@
> return ( TupleNode ) children.get( index ) ;
> }
>
>-
>+
> /* (non-Javadoc)
> * @see org.apache.asn1.ber.TupleNode#getIndex(
> * org.apache.asn1.ber.TupleNode)
>@@ -202,7 +202,7 @@
> {
> return children.indexOf( node ) ;
> }
>-
>+
>
> /* (non-Javadoc)
> * @see org.apache.asn1.ber.TupleNode#getChildCount()
>@@ -212,7 +212,7 @@
> return children.size() ;
> }
>
>-
>+
> /* (non-Javadoc)
> * @see org.apache.asn1.ber.TupleNode#size()
> */
>@@ -225,19 +225,19 @@
> else
> {
> int size = tuple.size() ;
>-
>- if ( tuple.isIndefinate() )
>- {
>+
>+ if ( tuple.isIndefinite() )
>+ {
> TupleNode child = null ;
> for ( int ii = 0; ii < children.size(); ii++ )
> {
> child = ( TupleNode ) children.get( ii ) ;
> size += child.size() ;
> }
>-
>+
> if ( child != null )
> {
>- if ( ! child.getTuple().isIndefinateTerminator() )
>+ if ( ! child.getTuple().isIndefiniteTerminator() )
> {
> size += 2 ;
> }
>@@ -252,7 +252,7 @@
> }
> }
>
>-
>+
> /* (non-Javadoc)
> * @see org.apache.asn1.ber.TupleNode#getTuple()
> */
>@@ -260,8 +260,8 @@
> {
> return tuple ;
> }
>-
>-
>+
>+
> /* (non-Javadoc)
> * @see org.apache.asn1.ber.MutableTupleNode#setTuple(
> * org.apache.asn1.ber.Tuple)
>@@ -271,7 +271,7 @@
> tuple = t ;
> valueChunks.clear() ;
> }
>-
>+
>
> /*
> * (non-Javadoc)
>@@ -284,7 +284,7 @@
> this.valueChunks.clear() ;
> this.valueChunks.addAll( valueChunks ) ;
> }
>-
>+
>
> /*
> * (non-Javadoc)
>@@ -294,8 +294,8 @@
> {
> return valueChunks ;
> }
>-
>-
>+
>+
> /*
> * (non-Javadoc)
> * @see org.apache.asn1.ber.MutableTupleNode#addValueChunk(
>@@ -306,49 +306,49 @@
> valueChunks.add( valueChunk ) ;
> }
>
>-
>+
> /**
> * Depth first generation of this tlv tuple node's encoded image.
>- *
>+ *
> * @see org.apache.asn1.ber.TupleNode#encode(ByteBuffer)
> */
> public void encode( ByteBuffer dest )
> {
> dest.put( tuple.toEncodedBuffer( this.valueChunks ) ) ;
>-
>+
> if ( tuple.isPrimitive() )
> {
> return ;
> }
>-
>+
> TupleNode child = null ;
> for ( int ii = 0; ii < children.size(); ii++ )
> {
> child = ( TupleNode ) children.get( ii ) ;
> child.encode( dest ) ;
> }
>-
>+
> if ( child != null )
> {
> Tuple childTuple = child.getTuple() ;
>- if ( childTuple.isIndefinateTerminator() )
>+ if ( childTuple.isIndefiniteTerminator() )
> {
> return ;
> }
> }
>-
>- if ( tuple.isIndefinate() )
>+
>+ if ( tuple.isIndefinite() )
> {
> // lay down the termination
> dest.put( ( byte ) 0 ) ;
> dest.put( ( byte ) 0 ) ;
> }
> }
>-
>-
>+
>+
> /*
>- * Prinsts some informative information regarding the tlv node.
>- *
>+ * Prinsts some informative information regarding the tlv node.
>+ *
> * (non-Javadoc)
> * @see java.lang.Object#toString()
> */
>@@ -360,14 +360,14 @@
> buf.append( '[' ).append( tuple.length ).append( ']' ) ;
> buf.append( '[' ).append( new String( tuple.getLastValueChunk().array() ) ) ;
> buf.append( ']' ) ;
>-
>+
> return buf.toString() ;
> }
>-
>+
>
> /**
> * Generates a depth first traversal of this node.
>- *
>+ *
> * @return a depth first traversal print out for this node
> */
> public String toDepthFirstString()
>@@ -400,7 +400,7 @@
>
> /**
> * Generates a depth first traversal of this node.
>- *
>+ *
> * @param buf the buffer to capture the traversal into
> * @param level the level down into the tree
> */
>@@ -408,12 +408,12 @@
> {
> DefaultMutableTupleNode child = null ;
> String levelTab = StringUtils.repeat( "\t", level ) ;
>-
>+
> if ( level != 0 )
> {
> buf.append( "\n" ) ;
> }
>-
>+
> buf.append( levelTab ).append( tuple.getId() ) ;
> buf.append( " [" ).append( "0x" ) ;
> buf.append( getHex( tuple.getRawPrimitiveTag() ) ) ;
>@@ -425,16 +425,16 @@
> child.printDepthFirst( buf, level + 1 ) ;
> }
> }
>-
>-
>+
>+
> // ------------------------------------------------------------------------
>- // java.lang.Object overrides & overloads
>+ // java.lang.Object overrides & overloads
> // ------------------------------------------------------------------------
>-
>-
>+
>+
> /**
> * Checks to see if this node and its children equal another exactly.
>- *
>+ *
> * @see java.lang.Object#equals(java.lang.Object)
> */
> public boolean equals( Object obj )
>@@ -443,28 +443,28 @@
> {
> return equals( this, ( DefaultMutableTupleNode ) obj ) ;
> }
>-
>+
> return false ;
> }
>-
>-
>+
>+
> /**
> * Checks to see if two nodes equal one another. The nodes must be exactly
> * the same even in terms of the order of their children and the children
> * of their descendants.
>- *
>+ *
> * @param n1 the first node
>- * @param n2 the second node
>+ * @param n2 the second node
> * @return true if <code>n1.equals(n2)</code> exactly otherwise false
> */
>- public static boolean equals( DefaultMutableTupleNode n1,
>+ public static boolean equals( DefaultMutableTupleNode n1,
> DefaultMutableTupleNode n2 )
> {
> if ( n1 == n2 )
> {
> return true ;
> }
>-
>+
> if ( ! n1.getTuple().equals( n2.getTuple() ) )
> {
> return false ;
>@@ -474,22 +474,22 @@
> {
> return false ;
> }
>-
>+
> DefaultMutableTupleNode n1Child = null ;
> DefaultMutableTupleNode n2Child = null ;
> for ( int ii = 0; ii < n1.getChildCount() ; ii++ )
> {
>- n1Child = ( DefaultMutableTupleNode )
>- n1.getChildTupleNodeAt( ii ) ;
>- n2Child = ( DefaultMutableTupleNode )
>+ n1Child = ( DefaultMutableTupleNode )
>+ n1.getChildTupleNodeAt( ii ) ;
>+ n2Child = ( DefaultMutableTupleNode )
> n2.getChildTupleNodeAt( ii ) ;
>-
>+
> if ( ! equals( n1Child, n2Child ) )
> {
> return false ;
> }
> }
>-
>+
> return true ;
> }
>
>
>Modified: incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/DeterminateLengthVisitor.java
>URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/DeterminateLengthVisitor.java?view=diff&r1=155925&r2=155926
>==============================================================================
>--- incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/DeterminateLengthVisitor.java (original)
>+++ incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/DeterminateLengthVisitor.java Wed Mar 2 07:14:39 2005
>@@ -1,5 +1,5 @@
> /*
>- * Copyright 2004 The Apache Software Foundation
>+ * Copyright 2004-2005 The Apache Software Foundation
> *
> * Licensed under the Apache License, Version 2.0 (the "License");
> * you may not use this file except in compliance with the License.
>@@ -55,12 +55,12 @@
> Tuple tlv = childTuple.getTuple() ;
>
> /*
>- * The tuple node may have child tuple nodes that are indefinate
>+ * The tuple node may have child tuple nodes that are indefinite
> * terminator nodes. When converting to the definate length form
> * these tuples must be detached from the tree and NOT factored
> * into length computations.
> */
>- if ( tlv.isIndefinateTerminator() )
>+ if ( tlv.isIndefiniteTerminator() )
> {
> // setting the parent to null removes it from the
> // parent's child list
>@@ -85,7 +85,7 @@
> */
> public boolean canVisit( TupleNode node )
> {
>- return node.getTuple().isIndefinate();
>+ return node.getTuple().isIndefinite();
> }
>
>
>
>Modified: incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/Length.java
>URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/Length.java?view=diff&r1=155925&r2=155926
>==============================================================================
>--- incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/Length.java (original)
>+++ incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/Length.java Wed Mar 2 07:14:39 2005
>@@ -1,5 +1,5 @@
> /*
>- * Copyright 2004 The Apache Software Foundation
>+ * Copyright 2004-2005 The Apache Software Foundation
> *
> * Licensed under the Apache License, Version 2.0 (the "License");
> * you may not use this file except in compliance with the License.
>@@ -31,7 +31,7 @@
> */
> public class Length
> {
>- /** used to mark length as indefinate */
>+ /** used to mark length as indefinite */
> public static final int INDEFINITE = -2 ;
> /** used to mark length as undefined */
> public static final int UNDEFINED = -1 ;
>
>Modified: incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/Tuple.java
>URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/Tuple.java?view=diff&r1=155925&r2=155926
>==============================================================================
>--- incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/Tuple.java (original)
>+++ incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/Tuple.java Wed Mar 2 07:14:39 2005
>@@ -24,27 +24,27 @@
>
>
> /**
>- * TLV Tuple used by the value chunking decoder. Because the length field is
>- * a primitive int it's maximum value is 2,147,483,647 a single TLV's tuple
>+ * TLV Tuple used by the value chunking decoder. Because the length field is
>+ * a primitive int it's maximum value is 2,147,483,647 a single TLV's tuple
> * cannot have a length over this amount or a value size over 2 GB.
>- *
>+ *
> * @author <a href="mailto:directory-dev@incubator.apache.org">
> * Apache Directory Project</a>
> * @version $Rev$
> */
>-public class Tuple
>+public class Tuple
> {
> /** empty buffer reused for handling null */
> private static final ByteBuffer EMPTY_BUFFER =
> ByteBuffer.wrap( ArrayUtils.EMPTY_BYTE_ARRAY ) ;
>-
>+
> /** mask for bit 5 with 0-based index */
> private static final int BIT_5 = 0x20 ;
> /** mask for bit 6 with 0-based index */
> private static final int BIT_6 = 0x40 ;
> /** mask for bit 7 with 0-based index */
> private static final int BIT_7 = 0x80 ;
>-
>+
> /** precalculated left shift of 1 by 14 places */
> private static final int BIT_13 = 1 << 14 ;
> /** precalculated left shift of 1 by 16 places */
>@@ -55,7 +55,7 @@
> private static final int BIT_23 = 1 << 24 ;
> /** precalculated left shift of 1 by 28 places */
> private static final int BIT_27 = 1 << 28 ;
>-
>+
> /** the raw tag data */
> int rawTag = 0 ;
> /** the tag id for this TLV tuple */
>@@ -68,17 +68,17 @@
> int length = 0 ;
> /** the present value chunk buffer read for this TLV tuple */
> ByteBuffer valueChunk = EMPTY_BUFFER ;
>-
>+
> /** tlv byte index */
> int index = Length.UNDEFINED ;
> /** tlv value index for how far into the value we have read */
> int valueIndex = Length.UNDEFINED ;
>-
>-
>+
>+
> // ------------------------------------------------------------------------
> // C O N S T R U C T O R S
> // ------------------------------------------------------------------------
>-
>+
>
> /**
> * Empty do nothing tuple.
>@@ -86,29 +86,29 @@
> public Tuple()
> {
> }
>-
>-
>+
>+
> /**
> * Creates constructed application type tlv tuples. Constructed TLV's with
> * a definate length will use this constructor predominantly. The TypeClass
> * defualts to APPLICATION.
>- *
>+ *
> * @param id the tag id of the tlv
>- * @param length the length of the value which is the length of all the
>+ * @param length the length of the value which is the length of all the
> * nested tuples.
> */
> public Tuple( int id, int length )
> {
> this( id, length, TypeClass.APPLICATION ) ;
> }
>-
>-
>+
>+
> /**
> * Creates constructed application type tlv tuples. Constructed TLV's with
> * a definate length will use this constructor predominantly.
>- *
>+ *
> * @param id the tag id of the tlv
>- * @param length the length of the value which is the length of all the
>+ * @param length the length of the value which is the length of all the
> * nested tuples.
> * @param typeClass the type class of this tlv tuple
> */
>@@ -118,20 +118,20 @@
> this.length = length ;
> valueChunk = EMPTY_BUFFER ;
> isPrimitive = false ;
>-
>+
> if ( typeClass != null )
> {
> this.typeClass = typeClass ;
> }
> }
>-
>-
>+
>+
> /**
> * Creates constructed application type tlv tuples. Constructed TLV's with
> * a definate length will use this constructor predominantly.
>- *
>+ *
> * @param id the tag id of the tlv
>- * @param length the length of the value which is the length of all the
>+ * @param length the length of the value which is the length of all the
> * nested tuples.
> * @param isPrimitive whether or not this Tuple is primitive or constructed
> * @param typeClass the type class of this tlv tuple
>@@ -142,18 +142,18 @@
> this.length = length ;
> valueChunk = EMPTY_BUFFER ;
> isPrimitive = false ;
>-
>+
> if ( typeClass != null )
> {
> this.typeClass = typeClass ;
> }
> }
>-
>-
>+
>+
> /**
>- * Creates a tuple where the length is indefinate. The tuple according to
>+ * Creates a tuple where the length is indefinite. The tuple according to
> * the BER encoding must be of the constructed type.
>- *
>+ *
> * @param id the tag id of the tlv
> * @param typeClass the type class for the tlv
> */
>@@ -162,23 +162,23 @@
> this.id = id ;
> this.isPrimitive = false ;
> valueChunk = EMPTY_BUFFER ;
>- length = Length.INDEFINATE ;
>-
>+ length = Length.INDEFINITE ;
>+
> if ( typeClass != null )
> {
> this.typeClass = typeClass ;
> }
> }
>-
>-
>+
>+
> // ------------------------------------------------------------------------
> // Public Accessors and Mutators
> // ------------------------------------------------------------------------
>-
>-
>+
>+
> /**
> * Gets the tag id for this TLV Tuple.
>- *
>+ *
> * @return the tag id
> */
> public int getId()
>@@ -201,7 +201,7 @@
>
> /**
> * Gets the raw tag as it is stuffed into a primitive int.
>- *
>+ *
> * @return a primitive int stuffed with the first four octets of the tag
> */
> public int getRawTag()
>@@ -258,11 +258,11 @@
>
>
> /**
>- * Gets the raw tag with the primitive/constructed flag dubbed out.
>+ * Gets the raw tag with the primitive/constructed flag dubbed out.
> * Effectively this makes every tag appear primitive and is done
>- * to remove encoding ambiguities that could interfere with pattern
>+ * to remove encoding ambiguities that could interfere with pattern
> * matching.
>- *
>+ *
> * @return the raw tag with the primitive/constructed flag dubbed out
> */
> public int getRawPrimitiveTag()
>@@ -270,35 +270,35 @@
> return rawTag & 0xDFFFFFFF ;
> }
>
>-
>+
> /**
>- * Get's whether or not this tuples's length is indefinate.
>- *
>- * @return whether or not this tuple's length is indefinate
>+ * Get's whether or not this tuples's length is indefinite.
>+ *
>+ * @return whether or not this tuple's length is indefinite
> */
>- public boolean isIndefinate()
>+ public boolean isIndefinite()
> {
>- return length == Length.INDEFINATE ;
>+ return length == Length.INDEFINITE ;
> }
>-
>+
>
> /**
>- * Get's whether or not this tuple terminates an indefinate constructed
>+ * Get's whether or not this tuple terminates an indefinite constructed
> * tuple. This means that length == 0 && isPrimitive = true && id == 0
> * and the type class is universal.
>- *
>- * @return whether or not this node's length is indefinate
>+ *
>+ * @return whether or not this node's length is indefinite
> */
>- public boolean isIndefinateTerminator()
>+ public boolean isIndefiniteTerminator()
> {
>- return isPrimitive && id == 0 && length <= 0 &&
>+ return isPrimitive && id == 0 && length <= 0 &&
> typeClass.equals( TypeClass.UNIVERSAL ) ;
> }
>-
>+
>
> /**
> * Gets whether or not this TLV tuple is primitive or constructed.
>- *
>+ *
> * @return true if it is primitive, false if it is constructed
> */
> public boolean isPrimitive()
>@@ -306,10 +306,10 @@
> return isPrimitive ;
> }
>
>-
>+
> /**
> * Gets the value length for this TLV Tuple.
>- *
>+ *
> * @return the length in bytes of the value field for this TLV tuple
> */
> public int getLength()
>@@ -327,7 +327,7 @@
>
> /**
> * Gets the BER TLV TypeClass for this TLV Tuple.
>- *
>+ *
> * @return the BER TLV TypeClass for this TLV Tuple
> */
> public TypeClass getTypeClass()
>@@ -335,10 +335,10 @@
> return typeClass ;
> }
>
>-
>+
> /**
> * Gets the last chunk read for the value field (V-part) for this TLV Tuple.
>- *
>+ *
> * @return the last valueChunk field for this TLV Tuple
> */
> public ByteBuffer getLastValueChunk()
>@@ -363,13 +363,13 @@
> * Gets the total size of this TLV tuple in bytes. This includes the
> * length of the tag field, the length of the length field and the length
> * of the value feild.
>- *
>+ *
> * @return the total TLV size in bytes
> */
> public int size()
> {
>- if ( this.length == Length.INDEFINATE )
>- {
>+ if ( this.length == Length.INDEFINITE )
>+ {
> return getTagLength() + getLengthLength() ;
> }
> else
>@@ -377,13 +377,13 @@
> return getTagLength() + getLengthLength() + length ;
> }
> }
>-
>-
>+
>+
> // ------------------------------------------------------------------------
> // Utility methods and java.lang.Object overrides
> // ------------------------------------------------------------------------
>-
>-
>+
>+
> /**
> * Clears the values of this tuple.
> */
>@@ -399,7 +399,7 @@
> this.valueIndex = Length.UNDEFINED ;
> }
>
>-
>+
> /**
> * Does not take into account the value, index or the valueIndex values when
> * checking for equality. Technically if both are being constructed by
>@@ -416,37 +416,37 @@
> {
> return true ;
> }
>-
>+
> if ( o instanceof Tuple )
> {
> Tuple t = ( Tuple ) o ;
>-
>+
> if ( t.id != id )
> {
> return false ;
> }
>-
>+
> if ( t.isPrimitive != isPrimitive )
> {
> return false ;
> }
>-
>+
> if ( t.length != length )
> {
> return false ;
> }
>-
>+
> if ( t.typeClass != typeClass )
> {
> return false ;
> }
>-
>+
> return true ;
> }
>-
>+
> return false ;
> }
>-
>+
>
> /*
> * (non-Javadoc)
>@@ -460,11 +460,11 @@
> t.isPrimitive = isPrimitive ;
> t.typeClass = typeClass ;
> t.length = length ;
>-
>+
> /* ------------------------------------------------------------------ +/
> * @todo figure out if we should remove this section
>- *
>- * Do think we need this anymore since the last valueChunk does not
>+ *
>+ * Do think we need this anymore since the last valueChunk does not
> * factor into the result returned by the equals(Object) method?
> * ------------------------------------------------------------------ */
> ByteBuffer bb = valueChunk ;
>@@ -477,25 +477,25 @@
> cloned.rewind() ;
> t.valueChunk = cloned ;
> /* ------------------------------------------------------------------ */
>-
>+
> t.index = index ;
> t.valueIndex = valueIndex ;
>-
>+
> return t ;
> }
>-
>-
>+
>+
> // ------------------------------------------------------------------------
> // Tuple encoding operations
> // ------------------------------------------------------------------------
>-
>-
>+
>+
> /**
> * If this is a primitive TLV then the valueBytes argument is used to
> * produce an encoded image of this TLV. If it is constructed then
> * only the TL part of the tuple is encoded leaving the value to be encoded
> * by the set of child TLVs.
>- *
>+ *
> * @todo this should produce chunking output and needs to be removed from
> * here actually and made into a standalone encoder. You give it a buffer
> * and it fills it as much as it can remembering where the encode stopped.
>@@ -509,56 +509,56 @@
> int tagLength = getTagLength() ;
> int lengthLength = getLengthLength() ;
> int total = tagLength + lengthLength ;
>-
>+
> if ( isPrimitive )
> {
> total += length ;
> }
>-
>+
> octets = ByteBuffer.allocate( total ) ;
> setTag( octets, tagLength ) ;
> setLength( octets, lengthLength ) ;
>-
>+
> if ( isPrimitive )
> {
> for ( int ii = 0; ii < valueChunks.size(); ii++ )
>- {
>+ {
> octets.put( ( ByteBuffer ) valueChunks.get(ii) ) ;
> }
> }
>-
>+
> return ( ByteBuffer ) octets.flip() ;
> }
>-
>-
>+
>+
> /**
> * Sets the tag section within the buffer.
>- *
>+ *
> * @param octets the buffer to set the tag in
> * @param tagLength the length of the tag section
> */
> public void setTag( ByteBuffer octets, int tagLength )
> {
> if ( tagLength >= 6 )
>- {
>+ {
> throw new IllegalArgumentException( "cannot support id's as large "
> + "as " + id + " unless we start using longs for the id" ) ;
> }
>
> byte octet = ( byte ) typeClass.getValue() ;
> int i = octets.position();
>-
>+
> if ( ! isPrimitive )
> {
> octet |= BIT_5;
> }
>-
>- if ( id < 31 )
>+
>+ if ( id < 31 )
> {
> octets.put( ( byte ) ( octet | (id & Tag.SHORT_MASK ) ) ) ;
> return;
>-
>- }
>+
>+ }
> else
> {
> octets.put( ( byte ) ( octet | Tag.SHORT_MASK ) ) ;
>@@ -610,7 +610,7 @@
>
> /**
> * Sets the length bytes.
>- *
>+ *
> * @param octets the byte [] to set length in
> * @param lengthBytes the number bytes for the length section
> */
>@@ -624,7 +624,7 @@
> + "the length" ) ;
> }
>
>- if ( length == Length.INDEFINATE )
>+ if ( length == Length.INDEFINITE )
> {
> octets.put( ( byte ) BIT_7 ) ;
> return ;
>@@ -701,13 +701,13 @@
> // {
> // return ;
> // }
>-
>+
> }
>
>
> /**
> * Gets the length in bytes of the tag section for this TLV tuple.
>- *
>+ *
> * @return the length in bytes of the tag section for this TLV tuple
> */
> public int getTagLength()
>@@ -720,7 +720,7 @@
> {
> return 2 ;
> }
>-
>+
> else if ( id < BIT_13 )
> {
> return 3 ;
>@@ -733,28 +733,28 @@
> {
> return 5 ;
> }
>-
>- throw new IllegalArgumentException( "cannot support id's larger than "
>+
>+ throw new IllegalArgumentException( "cannot support id's larger than "
> + id + " unless we start using longs for the id" ) ;
> }
>-
>-
>+
>+
> /**
> * Gets the length in bytes of the length section of this TLV Tuple.
>- *
>+ *
> * @return the length in bytes of the length section
> */
> public int getLengthLength()
> {
>- if ( length == Length.INDEFINATE )
>+ if ( length == Length.INDEFINITE )
> {
> return 1 ;
> }
>-
>+
> if ( length < 0 )
> {
>- throw new IllegalArgumentException( "integer overflow makes id "
>- + "negative with a value of " + id
>+ throw new IllegalArgumentException( "integer overflow makes id "
>+ + "negative with a value of " + id
> + " - unless we start using longs for"
> + " the id there you've hit a limitation" ) ;
> }
>@@ -774,7 +774,7 @@
> {
> return 4 ;
> }
>- else
>+ else
> {
> return 5 ;
> }
>
>Modified: incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TupleEncodingVisitor.java
>URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TupleEncodingVisitor.java?view=diff&r1=155925&r2=155926
>==============================================================================
>--- incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TupleEncodingVisitor.java (original)
>+++ incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TupleEncodingVisitor.java Wed Mar 2 07:14:39 2005
>@@ -1,5 +1,5 @@
> /*
>- * Copyright 2004 The Apache Software Foundation
>+ * Copyright 2004-2005 The Apache Software Foundation
> *
> * Licensed under the Apache License, Version 2.0 (the "License");
> * you may not use this file except in compliance with the License.
>@@ -58,7 +58,7 @@
> if ( obj instanceof DefaultMutableTupleNode )
> {
> ( ( DefaultMutableTupleNode ) obj ).accept( this );
>-
>+
> return;
> }
>
>@@ -110,8 +110,8 @@
> * N O T E
> * -------
> *
>- * We presume termination tuples exist for indefinate tuples as sibling
>- * nodes adjacent to the indefinate node. This is why we do not
>+ * We presume termination tuples exist for indefinite tuples as sibling
>+ * nodes adjacent to the indefinite node. This is why we do not
> * explicity handle termination here. The termination octets actually
> * represent another TLV tuple itself with a UNIVERSAL tag of 0 and a
> * length of 0.
>
>Modified: incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TupleTreeAnalyzer.java
>URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TupleTreeAnalyzer.java?view=diff&r1=155925&r2=155926
>==============================================================================
>--- incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TupleTreeAnalyzer.java (original)
>+++ incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TupleTreeAnalyzer.java Wed Mar 2 07:14:39 2005
>@@ -1,5 +1,5 @@
> /*
>- * Copyright 2004 The Apache Software Foundation
>+ * Copyright 2004-2005 The Apache Software Foundation
> *
> * Licensed under the Apache License, Version 2.0 (the "License");
> * you may not use this file except in compliance with the License.
>@@ -239,8 +239,8 @@
> exitForm(evt);
> }
> });
>-
>-
>+
>+
> jLabel3.setText("Type Class:");
> jPanel5.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
> jPanel5.add(jLabel3);
>@@ -264,23 +264,23 @@
> jTree1.setShowsRootHandles(true);
> jPanel1.setLayout(new java.awt.GridBagLayout());
> jPanel1.add(jPanel2,
>- new java.awt.GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
>- java.awt.GridBagConstraints.WEST,
>+ new java.awt.GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
>+ java.awt.GridBagConstraints.WEST,
> java.awt.GridBagConstraints.HORIZONTAL,
> new java.awt.Insets(0, 9, 0, 9), 0, 0));
> jPanel1.add(jPanel3,
>- new java.awt.GridBagConstraints(0, 1, 1, 1, 1.0, 1.0,
>- java.awt.GridBagConstraints.WEST,
>+ new java.awt.GridBagConstraints(0, 1, 1, 1, 1.0, 1.0,
>+ java.awt.GridBagConstraints.WEST,
> java.awt.GridBagConstraints.HORIZONTAL,
> new java.awt.Insets(0, 9, 0, 9), 0, 0));
> jPanel1.add(jPanel4,
>- new java.awt.GridBagConstraints(0, 3, 1, 35, 1.0, 1.0,
>- java.awt.GridBagConstraints.CENTER,
>+ new java.awt.GridBagConstraints(0, 3, 1, 35, 1.0, 1.0,
>+ java.awt.GridBagConstraints.CENTER,
> java.awt.GridBagConstraints.BOTH,
> new java.awt.Insets(9, 12, 9, 12), 0, 0));
> jPanel1.add(jPanel5,
>- new java.awt.GridBagConstraints(0, 2, 1, 1, 1.0, 1.0,
>- java.awt.GridBagConstraints.WEST,
>+ new java.awt.GridBagConstraints(0, 2, 1, 1, 1.0, 1.0,
>+ java.awt.GridBagConstraints.WEST,
> java.awt.GridBagConstraints.HORIZONTAL,
> new java.awt.Insets(0, 9, 0, 9), 0, 0));
> jLabel1.setText("Tag Id:");
>@@ -294,10 +294,10 @@
> jPanel4.setLayout(new java.awt.BorderLayout());
> jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(
> javax.swing.BorderFactory.createLineBorder(
>- new java.awt.Color(153, 153, 153), 1), "Value",
>- javax.swing.border.TitledBorder.LEADING,
>+ new java.awt.Color(153, 153, 153), 1), "Value",
>+ javax.swing.border.TitledBorder.LEADING,
> javax.swing.border.TitledBorder.TOP,
>- new java.awt.Font("Comic Sans MS", 0, 14),
>+ new java.awt.Font("Comic Sans MS", 0, 14),
> new java.awt.Color(60, 60, 60)));
> jPanel4.add(jScrollPane2, java.awt.BorderLayout.CENTER);
> jTextArea1.setText("");
>@@ -315,7 +315,7 @@
> jScrollPane2.setHorizontalScrollBarPolicy(
> javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
> jScrollPane2.setBorder(null);
>-
>+
> jTree1.setModel( new DefaultTreeModel(
> new TupleTreeNodeAdapter( root ) ) );
> jTree1.getSelectionModel().addTreeSelectionListener( this );
>@@ -336,17 +336,17 @@
> }
> }
>
>-
>+
> public void startup()
> {
> setSize( 800, 640 ) ;
> Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
> Dimension frameSize = getSize();
>- frameSize.height = ((frameSize.height > screenSize.height)
>+ frameSize.height = ((frameSize.height > screenSize.height)
> ? screenSize.height : frameSize.height);
>- frameSize.width = ((frameSize.width > screenSize.width)
>+ frameSize.width = ((frameSize.width > screenSize.width)
> ? screenSize.width : frameSize.width);
>- setLocation((screenSize.width - frameSize.width) / 2,
>+ setLocation((screenSize.width - frameSize.width) / 2,
> (screenSize.height - frameSize.height) / 2);
> setVisible(true);
> }
>@@ -364,9 +364,9 @@
> jTextField3.setText( type.getName() );
>
>
>- if ( tuple.getLength() == Length.INDEFINATE )
>+ if ( tuple.getLength() == Length.INDEFINITE )
> {
>- jTextField2.setText( "INDEFINATE" );
>+ jTextField2.setText( "INDEFINITE" );
> }
> else
> {
>@@ -383,7 +383,7 @@
> jTextField1.setText( Integer.toString( tuple.getId() ) );
> }
>
>- if ( tuple.isPrimitive() )
>+ if ( tuple.isPrimitive() )
> {
> ByteBuffer buf = ( ByteBuffer ) tuple.getLastValueChunk().rewind();
> byte[] bites = new byte[buf.remaining()];
>@@ -424,7 +424,7 @@
> + new String( bites ) );
> return;
> }
>-
>+
> int ii = PrimitiveUtils.decodeInt( bites, 0, bites.length );
> boolean bool = PrimitiveUtils.berDecodeBoolean( bites[0] );
> String tip = "Numeric: " + Integer.toString( ii ) + "\n";
>
>Modified: incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/digester/rules/PrimitiveOctetStringRule.java
>URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/digester/rules/PrimitiveOctetStringRule.java?view=diff&r1=155925&r2=155926
>==============================================================================
>--- incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/digester/rules/PrimitiveOctetStringRule.java (original)
>+++ incubator/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/digester/rules/PrimitiveOctetStringRule.java Wed Mar 2 07:14:39 2005
>@@ -1,5 +1,5 @@
> /*
>- * Copyright 2004 The Apache Software Foundation
>+ * Copyright 2004-2005 The Apache Software Foundation
> *
> * Licensed under the Apache License, Version 2.0 (the "License");
> * you may not use this file except in compliance with the License.
>@@ -118,7 +118,7 @@
> // @todo Length should not be visible outside of the digester
> // package. The digester or a contants interface should contain
> // these constants.
>- if ( Length.INDEFINATE != length )
>+ if ( Length.INDEFINITE != length )
> {
> accumulator.ensureCapacity( length ) ;
> }
>
>Modified: incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/BERDecoderTest.java
>URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/BERDecoderTest.java?view=diff&r1=155925&r2=155926
>==============================================================================
>--- incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/BERDecoderTest.java (original)
>+++ incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/BERDecoderTest.java Wed Mar 2 07:14:39 2005
>@@ -1,5 +1,5 @@
> /*
>- * Copyright 2004 The Apache Software Foundation
>+ * Copyright 2004-2005 The Apache Software Foundation
> *
> * Licensed under the Apache License, Version 2.0 (the "License");
> * you may not use this file except in compliance with the License.
>@@ -41,31 +41,31 @@
> */
> public class BERDecoderTest extends AbstractDecoderTestCase
> {
>- private static final ByteBuffer EMPTY_BUFFER =
>+ private static final ByteBuffer EMPTY_BUFFER =
> ByteBuffer.wrap( ArrayUtils.EMPTY_BYTE_ARRAY ) ;
>-
>-
>+
>+
> public BERDecoderTest()
> {
> super( BERDecoderTest.class.getName() ) ;
> }
>-
>-
>+
>+
> public void testBasisCases() throws Exception
> {
> decoder.setDecoderMonitor( new DecoderMonitorAdapter() ) ;
> decoder.decode( null ) ;
> decoder.decode( EMPTY_BUFFER ) ;
> }
>-
>-
>+
>+
> public void testPrimitives() throws Exception
> {
> Tuple decoded = null ;
> Tuple t = new Tuple( 45, 0, true, TypeClass.APPLICATION ) ;
>- assertTrue( decode( t, EMPTY_BUFFER ).equals( t ) ) ;
>-
>- t = new Tuple( 45, "Hello world!".length(), true,
>+ assertTrue( decode( t, EMPTY_BUFFER ).equals( t ) ) ;
>+
>+ t = new Tuple( 45, "Hello world!".length(), true,
> TypeClass.APPLICATION ) ;
> decoded = decode( t, ByteBuffer.wrap( "Hello world!".getBytes() ) ) ;
> assertTrue( decoded.equals( t ) ) ;
>@@ -77,18 +77,18 @@
> assertTrue( decoded.equals( t ) ) ;
> assertEquals( mesg, toString( decoded.getLastValueChunk() ) ) ;
> }
>-
>-
>+
>+
> String toString(ByteBuffer buf)
> {
> buf = buf.slice() ;
> byte[] bites = new byte[buf.remaining()] ;
> buf.get( bites ) ;
>- return new String( bites ) ;
>+ return new String( bites ) ;
> }
>-
>-
>- public void testConstructedIndefinate() throws Exception
>+
>+
>+ public void testConstructedIndefinite() throws Exception
> {
> Tuple top = new Tuple( 1, TypeClass.APPLICATION ) ;
> Tuple t0 = new Tuple( 2, "Hello".length(),
>@@ -98,19 +98,19 @@
> Tuple terminator = new Tuple( 0, 0, true, TypeClass.UNIVERSAL ) ;
> assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) ) ;
>
>- Tuple decoded = decode( t0, ByteBuffer.wrap( "Hello".getBytes() ) ) ;
>+ Tuple decoded = decode( t0, ByteBuffer.wrap( "Hello".getBytes() ) ) ;
> assertTrue( decoded.equals( t0 ) ) ;
> assertEquals( "Hello", toString( decoded.getLastValueChunk() ) ) ;
>-
>- decoded = decode( t1, ByteBuffer.wrap( "World".getBytes() ) ) ;
>+
>+ decoded = decode( t1, ByteBuffer.wrap( "World".getBytes() ) ) ;
> assertTrue( decoded.equals( t1 ) ) ;
> assertEquals( "World", toString( decoded.getLastValueChunk() ) ) ;
>-
>+
> decoded = decode( terminator, EMPTY_BUFFER ) ;
> assertTrue( decoded.equals( top ) ) ;
> }
>-
>-
>+
>+
> public void testConstructedLongLengthForm() throws Exception
> {
> String str0 = RandomStringUtils.randomAlphanumeric(128) ;
>@@ -120,35 +120,35 @@
> Tuple top = new Tuple( 1, t0.size() + t1.size() ) ;
> assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) ) ;
>
>- Tuple decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) ) ;
>+ Tuple decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) ) ;
> assertTrue( decoded.equals( t0 ) ) ;
> assertEquals( str0, toString( decoded.getLastValueChunk() ) ) ;
>-
>- // automatically set to top because after t1 is delivered top is
>- decoded = decode( t1, ByteBuffer.wrap( str1.getBytes() ) ) ;
>+
>+ // automatically set to top because after t1 is delivered top is
>+ decoded = decode( t1, ByteBuffer.wrap( str1.getBytes() ) ) ;
> assertTrue( decoded.equals( top ) ) ;
> }
>
>
> public void testConstructedShortLengthForm() throws Exception
> {
>- Tuple t0 = new Tuple( 2, "Hello".length(), true,
>+ Tuple t0 = new Tuple( 2, "Hello".length(), true,
> TypeClass.APPLICATION ) ;
>- Tuple t1 = new Tuple( 3, "World".length(), true,
>+ Tuple t1 = new Tuple( 3, "World".length(), true,
> TypeClass.APPLICATION ) ;
> Tuple top = new Tuple( 1, t0.size() + t1.size() ) ;
> assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) ) ;
>
>- Tuple decoded = decode( t0, ByteBuffer.wrap( "Hello".getBytes() ) ) ;
>+ Tuple decoded = decode( t0, ByteBuffer.wrap( "Hello".getBytes() ) ) ;
> assertTrue( decoded.equals( t0 ) ) ;
> assertEquals( "Hello", toString( decoded.getLastValueChunk() ) ) ;
>-
>- // automatically set to top because after t1 is delivered top is
>- decoded = decode( t1, ByteBuffer.wrap( "World".getBytes() ) ) ;
>+
>+ // automatically set to top because after t1 is delivered top is
>+ decoded = decode( t1, ByteBuffer.wrap( "World".getBytes() ) ) ;
> assertTrue( decoded.equals( top ) ) ;
> }
>-
>-
>+
>+
> public void testFragmentedValue() throws Exception
> {
> String str0 = RandomStringUtils.randomAlphanumeric(20) ;
>@@ -163,21 +163,21 @@
> ByteBuffer all = t0.toEncodedBuffer( list ) ;
> ByteBuffer[] fragments = fragment( all, 10 ) ;
> Tuple decoded = null ;
>-
>+
> for ( int ii = 0; ii < fragments.length; ii++ )
> {
> decoded = decode( fragments[ii] ) ;
> }
>-
>+
> assertTrue( decoded.equals( t0 ) ) ;
> assertEquals( str0, toString( buf ) ) ;
>-
>- // automatically set to top because after t1 is delivered top is
>- decoded = decode( t1, ByteBuffer.wrap( str1.getBytes() ) ) ;
>+
>+ // automatically set to top because after t1 is delivered top is
>+ decoded = decode( t1, ByteBuffer.wrap( str1.getBytes() ) ) ;
> assertTrue( decoded.equals( top ) ) ;
> }
>-
>-
>+
>+
> public void testDecodeOccurred()
> {
> try
>@@ -190,8 +190,8 @@
> assertNotNull( e ) ;
> }
> }
>-
>-
>+
>+
> public void testFireTagDecoded() throws Exception
> {
> decoder.setDecoderMonitor( new BERMonitor() ) ;
>@@ -200,16 +200,16 @@
> String str1 = RandomStringUtils.randomAlphanumeric(20) ;
> Tuple t1 = new Tuple( 3, str1.length() ) ;
> Tuple top = new Tuple( 1, t0.size() + t1.size() ) ;
>- Tuple decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) ) ;
>+ Tuple decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) ) ;
> assertTrue( decoded.equals( t0 ) ) ;
>-
>- // automatically set to top because after t1 is delivered top is
>- decoded = decode( t1, ByteBuffer.wrap( str1.getBytes() ) ) ;
>-
>+
>+ // automatically set to top because after t1 is delivered top is
>+ decoded = decode( t1, ByteBuffer.wrap( str1.getBytes() ) ) ;
>+
> assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) ) ;
>-
>+
> decoder.setDecoderMonitor(null) ;
>- decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) ) ;
>+ decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) ) ;
> assertTrue( decoded.equals( t0 ) ) ;
>
> tlvList.clear() ;
>@@ -228,11 +228,11 @@
> String str1 = RandomStringUtils.randomAlphanumeric(20) ;
> Tuple t1 = new Tuple( 3, str1.length() ) ;
> Tuple top = new Tuple( 1, t0.size() + t1.size() ) ;
>- Tuple decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) ) ;
>+ Tuple decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) ) ;
> assertTrue( decoded.equals( t0 ) ) ;
>-
>- // automatically set to top because after t1 is delivered top is
>- decoded = decode( t1, ByteBuffer.wrap( str1.getBytes() ) ) ;
>+
>+ // automatically set to top because after t1 is delivered top is
>+ decoded = decode( t1, ByteBuffer.wrap( str1.getBytes() ) ) ;
> assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) ) ;
> }
>
>@@ -247,9 +247,9 @@
> Tuple t1 = new Tuple( 3, str1.length() ) ;
> Tuple top = new Tuple( 1, t0.size() + t1.size() ) ;
> decode( t0, ByteBuffer.wrap( str0.getBytes() ) ) ;
>-
>- // automatically set to top because after t1 is delivered top is
>- decode( t1, ByteBuffer.wrap( str1.getBytes() ) ) ;
>+
>+ // automatically set to top because after t1 is delivered top is
>+ decode( t1, ByteBuffer.wrap( str1.getBytes() ) ) ;
> assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) ) ;
> }
>
>@@ -264,8 +264,8 @@
> Tuple t1 = new Tuple( 3, str1.length() ) ;
> Tuple top = new Tuple( 1, t0.size() + t1.size() ) ;
> decode( t0, ByteBuffer.wrap( str0.getBytes() ) );
>-
>- // automatically set to top because after t1 is delivered top is
>+
>+ // automatically set to top because after t1 is delivered top is
> decode( t1, ByteBuffer.wrap( str1.getBytes() ) ) ;
> assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) ) ;
> }
>@@ -275,18 +275,18 @@
> {
> public void callbackOccured(StatefulDecoder decoder,
> DecoderCallback cb, Object decoded) { }
>-
>+
> public void error(StatefulDecoder decoder, Exception exception) { }
>-
>+
> public void callbackSet(StatefulDecoder decoder, DecoderCallback oldcb,
> DecoderCallback newcb) { }
>-
>+
> public void fatalError(StatefulDecoder decoder, Exception exception){}
>-
>+
> public void lengthDecoded( Tuple tlv ) { }
>-
>+
> public void tagDecoded( Tuple tlv ) { }
>-
>+
> public void warning( StatefulDecoder decoder, Exception exception ) { }
> }
> }
>
>Modified: incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/BEREncoderTest.java
>URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/BEREncoderTest.java?view=diff&r1=155925&r2=155926
>==============================================================================
>--- incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/BEREncoderTest.java (original)
>+++ incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/BEREncoderTest.java Wed Mar 2 07:14:39 2005
>@@ -1,5 +1,5 @@
> /*
>- * Copyright 2004 The Apache Software Foundation
>+ * Copyright 2004-2005 The Apache Software Foundation
> *
> * Licensed under the Apache License, Version 2.0 (the "License");
> * you may not use this file except in compliance with the License.
>@@ -32,7 +32,7 @@
>
> /**
> * Tests the BEREncoder for correct operation.
>- *
>+ *
> * @author <a href="mailto:directory-dev@incubator.apache.org"> Apache Directory
> * Project</a> $Rev$
> */
>@@ -218,13 +218,13 @@
> /**
> * Produces the tlv events for constructed TLV of definate length.
> */
>- public void testConstructedInDefinateLength()
>+ public void testConstructedIndefiniteLength()
> {
> // prepare top level TLV of sequence with length of 3
> Tuple top = new Tuple();
> top.setTag( UniversalTag.SEQUENCE_SEQUENCE_OF, false );
> encoder.tag( top );
>- top.setLength( Length.INDEFINATE );
>+ top.setLength( Length.INDEFINITE );
> encoder.length( top );
>
> // prepare the expected correct sequence of encoded bytes
>
>Modified: incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/ConstructedTLVTests.java
>URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/ConstructedTLVTests.java?view=diff&r1=155925&r2=155926
>==============================================================================
>--- incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/ConstructedTLVTests.java (original)
>+++ incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/ConstructedTLVTests.java Wed Mar 2 07:14:39 2005
>@@ -1,5 +1,5 @@
> /*
>- * Copyright 2004 The Apache Software Foundation
>+ * Copyright 2004-2005 The Apache Software Foundation
> *
> * Licensed under the Apache License, Version 2.0 (the "License");
> * you may not use this file except in compliance with the License.
>@@ -38,8 +38,8 @@
> {
> super( arg0 ) ;
> }
>-
>-
>+
>+
> public void testConstructedDefinateTLV() throws Exception
> {
> // decode tag
>@@ -49,11 +49,11 @@
> assertEquals( false, outter.isPrimitive ) ;
> assertEquals( TypeClass.APPLICATION, outter.typeClass ) ;
> assertEquals( BERDecoderState.LENGTH, decoder.getState() ) ;
>-
>- // decode length
>+
>+ // decode length
> outter = decode( "00000011" ) ;
> assertEquals( BERDecoderState.TAG, decoder.getState() ) ;
>-
>+
> // decode tag
> Tuple tlv = decode( "01000001" ) ;
> assertEquals( 1, tlv.id ) ;
>@@ -61,12 +61,12 @@
> assertEquals( true, tlv.isPrimitive ) ;
> assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
> assertEquals( BERDecoderState.LENGTH, decoder.getState() ) ;
>-
>- // decode length
>+
>+ // decode length
> tlv = decode( "00000001" ) ;
> assertEquals( BERDecoderState.VALUE, decoder.getState() ) ;
> assertEquals( 1, tlv.length ) ;
>-
>+
> // decode value
> tlv = decode( "01010101" ) ;
> assertEquals( BERDecoderState.TAG, decoder.getState() ) ;
>@@ -74,10 +74,10 @@
> }
>
>
>- public void testMultipleIndefinateTLV() throws Exception
>+ public void testMultipleIndefiniteTLV() throws Exception
> {
> // --------------------------------------------------------------------
>-
>+
> // decode tag
> Tuple outter = decode( "01100001" ) ;
> assertEquals( 1, outter.id ) ;
>@@ -85,15 +85,15 @@
> assertEquals( false, outter.isPrimitive ) ;
> assertEquals( TypeClass.APPLICATION, outter.typeClass ) ;
> assertEquals( BERDecoderState.LENGTH, decoder.getState() ) ;
>-
>- // decode length
>+
>+ // decode length
> outter = decode( "10000000" ) ;
> assertEquals( BERDecoderState.TAG, decoder.getState() ) ;
>
>-
>+
> // --------------------------------------------------------------------
>
>-
>+
> // decode tag
> Tuple tlv = decode( "01000001" ) ;
> assertEquals( 1, tlv.id ) ;
>@@ -101,13 +101,13 @@
> assertEquals( true, tlv.isPrimitive ) ;
> assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
> assertEquals( BERDecoderState.LENGTH, decoder.getState() ) ;
>-
>- // decode length
>+
>+ // decode length
> tlv = decode( "00000001" ) ;
> assertEquals( BERDecoderState.VALUE, decoder.getState() ) ;
> assertEquals( 1, tlv.length ) ;
> assertEquals( 0, tlvList.size() ) ;
>-
>+
> // decode value
> tlv = decode( "01010101" ) ;
> assertEquals( BERDecoderState.TAG, decoder.getState() ) ;
>@@ -115,7 +115,7 @@
> assertNotNull( tlv.valueChunk ) ;
> assertEquals( 0x0055, 0x00ff & tlv.valueChunk.get( 0 ) ) ;
>
>-
>+
> // --------------------------------------------------------------------
>
>
>@@ -126,12 +126,12 @@
> assertEquals( true, tlv.isPrimitive ) ;
> assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
> assertEquals( BERDecoderState.LENGTH, decoder.getState() ) ;
>-
>- // decode length
>+
>+ // decode length
> tlv = decode( "00000001" ) ;
> assertEquals( BERDecoderState.VALUE, decoder.getState() ) ;
> assertEquals( 1, tlv.length ) ;
>-
>+
> // decode value
> tlv = decode( "01010101" ) ;
> assertEquals( BERDecoderState.TAG, decoder.getState() ) ;
>@@ -139,7 +139,7 @@
> assertNotNull( tlv.valueChunk ) ;
> assertEquals( 0x0055, 0x00ff & tlv.valueChunk.get( 0 ) ) ;
>
>-
>+
> // --------------------------------------------------------------------
>
>
>@@ -150,12 +150,12 @@
> assertEquals( true, tlv.isPrimitive ) ;
> assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
> assertEquals( BERDecoderState.LENGTH, decoder.getState() ) ;
>-
>- // decode length
>+
>+ // decode length
> tlv = decode( "00000001" ) ;
> assertEquals( BERDecoderState.VALUE, decoder.getState() ) ;
> assertEquals( 1, tlv.length ) ;
>-
>+
> // decode value
> tlv = decode( "01010101" ) ;
> assertEquals( BERDecoderState.TAG, decoder.getState() ) ;
>@@ -165,7 +165,7 @@
>
> decode( "00000000" ) ;
> decode( "00000000" ) ;
>-
>+
> assertEquals( 4, tlvList.size() ) ;
> assertEquals( BERDecoderState.TAG, decoder.getState() ) ;
> }
>@@ -173,13 +173,13 @@
>
> public void testIllegalState() throws Exception
> {
>- try
>+ try
> {
> decode( "00000000" ) ;
> decode( "00000000" ) ;
> fail( "should throw an exception before getting here" ) ;
> }
>- catch( Throwable e )
>+ catch( Throwable e )
> {
> assertNotNull( e ) ;
> }
>@@ -189,14 +189,14 @@
> public void testIllegalStateNoMonitor() throws Exception
> {
> decoder.setDecoderMonitor( null ) ;
>-
>- try
>+
>+ try
> {
> decode( "00000000" ) ;
> decode( "00000000" ) ;
> fail( "should throw an exception before getting here" ) ;
> }
>- catch( Throwable e )
>+ catch( Throwable e )
> {
> assertNotNull( e ) ;
> }
>
>
>
>
>