-
CSR
-
Resolution: Withdrawn
-
P4
-
None
-
None
-
behavioral
-
low
-
-
Java API
-
Implementation
Summary
Enhance several Subject$SecureSet
methods to better deal with null
values.
Problem
Subject$SecureSet
is used to store principals and credentials returned by JAAS Subject
's getPrincipals()
, getPublicCredentials()
, and getPrivateCredentials()
methods. Since null
is not allowed in this set, when contains(null)
(and other methods) is called on such a set, an NPE is thown. This is slow comparing to returning null
.
Solution
Switch from "throw-NPE" to "return false/ignore" when dealing with null
values in multiple methods of Subject$SecureSet
. Both styles are allowed by the Set
interface.
Precisely,
- when calling
contains
orremove
on null, false is returned. - when calling
containsAll
on a collection containing null, false is returned - when calling
removeAll
, andretainAll
on a collection containing a null value, the null value is ignored.
Specification
No spec change.
- csr of
-
JDK-8243592 Subject$SecureSet::contains(null) is suboptimal
- Resolved