JDK-7123424 : (coll) CopyOnWriteArrayList/CopyOnWriteArraySet don't throw NPE for removeAll(null)/retainAll(null)
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.concurrent
  • Affected Version: 8
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: generic
  • Submitted: 2011-12-21
  • Updated: 2013-08-02
  • Resolved: 2013-05-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8Fixed
Related Reports
Relates :  
Relates :  
Description
CopyOnWriteArrayList/CopyOnWriteArraySet should throw NPE for removeAll(null)/retainAll(null) as noted in the specification in all cases.  A NPE is not thrown in the case where the CopyOnWriteArrayList/CopyOnWriteArraySet collection has no elements and then removeAll(null)/retainAll(null) is called.

Comments
Fixed in JDK-8001575
03-05-2013

EVALUATION Need to do a null check for removeAll(null)/retainAll(null) and throw NPE if needed. The change to CopyOnWriteArrayList doesn't use Objects.requireNonNull because this code has to sync up with Doug Lea's jsr166 repository which runs on multiple version of the platform (some without requireNonNull). Also CopyOnWriteArraySet is fixed implicitly by the fix to CopyOnWriteArrayList.
03-01-2012