[concurrency-interest] LinkedBlockingQueue does not throw NullPointerException for the method call contains

Kasper Nielsen kasper at kav.dk
Sun Apr 15 18:14:03 EDT 2007


Joe Bowbeer wrote:
> Good point.  Looks like a bug to me.  Will you report it?
>
> I expect this applies to all subclasses of AbstractQueue.
>
>   
If this is a bug, remove/removeAll and retainAll should also be fixed
as well as the collection views returned by ConcurrentHashMap and 
ConcurrentSkipListMap.

- Kasper
> On 4/15/07, Szabolcs Ferenczi <szabolcs.ferenczi at gmail.com> wrote:
>   
>> On 15/04/07, Joe Bowbeer <joe.bowbeer at gmail.com> wrote:
>>     
>>> Where is the null inserted in your test?
>>>       
>> It is not inserted but queried, see "q.contains(null)"
>>
>> The documentation for method "public boolean contains(Object o)" says:
>>
>> "Throws:
>> ...
>> NullPointerException - if the specified element is null and this
>> collection does not permit null elements (optional)"
>>
>> It seems LinkedBlockingQueue does not permit null elements, does it?
>>
>> Best Regards,
>> Szabolcs
>>
>>     
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>   



More information about the Concurrency-interest mailing list