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

Joe Bowbeer joe.bowbeer at gmail.com
Sun Apr 15 17:29:59 EDT 2007


Good point.  Looks like a bug to me.  Will you report it?

I expect this applies to all subclasses of AbstractQueue.


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
>


More information about the Concurrency-interest mailing list