-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.3.0
-
generic
-
generic
Name: krT82822 Date: 11/04/99
Collections.unmodifiableCollection(Collection source) accepts null argument.
If you call size() of the returned collection, a NullPointerException is thrown,
because the unmodifiable collection calls source.size(), and source is null.
I would recommend to change result of Collections.unmodifiableCollection using
Collections.EMPTY_LIST (or, better, something like Collections.EMPTY_COLLECTION)
if a null argument is passed to the method.
(Review ID: 97358)
======================================================================
- duplicates
-
JDK-4189641 Passing a null array to Arrays.asList() doesn't return null or throw Exception
-
- Resolved
-