Marcus Crafter wrote:
> On Mon, Feb 25, 2002 at 02:10:00PM -0500, Berin Loritsch wrote:
> 
>>Marcus Crafter wrote:
>>
>>>     BTW - is FixedSizeBuffer allowed to hold null elements, as this
>>>     case seems to be broken as well ? (remove() won't remove null
>>>     items, but add() will store them).
>>>
>>
>>No, it should not hold null elements.
>>
> 
>       ok. Attached is a patch to fix this too.

All applied, tested, and committed.

Thanks a heap, man!

> 
>       Cheers,
> 
>       Marcus
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Index: FixedSizeBuffer.java
> ===================================================================
> RCS file: 
>/home/cvspublic/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/collections/FixedSizeBuffer.java,v
> retrieving revision 1.1
> diff -u -r1.1 FixedSizeBuffer.java
> --- FixedSizeBuffer.java      20 Dec 2001 18:28:33 -0000      1.1
> +++ FixedSizeBuffer.java      25 Feb 2002 19:14:59 -0000
> @@ -50,8 +50,19 @@
>          return size() == 0;
>      }
>  
> +    /**
> +     * Adds an object to the buffer.
> +     *
> +     * @param element object to add, must not be null
> +     * @throws NullPointerException if element is null
> +     */
>      public final void add( Object element )
>      {
> +        if ( element == null )
> +        {
> +            throw new NullPointerException( "Refusing to add a null element" );
> +        }
> +
>          if ( size() > m_elements.length )
>          {
>              throw new BufferOverflowException( "The buffer cannot hold more than "
> 
> 
> 
> ------------------------------------------------------------------------
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 



-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to