Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProviderManager#checkState() throws NullPointerException #8689

Closed
yukihane opened this issue Jun 13, 2020 · 1 comment
Closed

ProviderManager#checkState() throws NullPointerException #8689

yukihane opened this issue Jun 13, 2020 · 1 comment
Assignees
Labels
in: core An issue in spring-security-core type: enhancement A general enhancement
Milestone

Comments

@yukihane
Copy link
Contributor

Describe the bug

When use java.util.List.of(), ProviderManager#checkState() throws NullPointerException.

checkState() uses List#contains(null) since #7713 (comment), but it may throws NullPointerException:

NullPointerException - if the specified element is null and this list does not permit null elements (optional)

To Reproduce

new ProviderManager(List.of(myProvider));

Expected behavior

NPE is not thrown.

@yukihane yukihane added status: waiting-for-triage An issue we've not yet triaged type: bug A general bug labels Jun 13, 2020
@jzheaux jzheaux self-assigned this Jun 15, 2020
@jzheaux
Copy link
Contributor

jzheaux commented Jun 15, 2020

@yukihane thank you for the suggestion that the exception be refined. It's a nice improvement to be able to replace an NPE with a more helpful error message.

Would you be interested in submitting a PR to change this check into a for loop?

@jzheaux jzheaux added in: core An issue in spring-security-core type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged type: bug A general bug labels Jun 15, 2020
jzheaux pushed a commit that referenced this issue Jun 16, 2020
- Renamed test to follow naming convention
- Simplified mock with Mockito
- Added note regarding related ticket

Issue gh-8689
@jzheaux jzheaux added this to the 5.4.0-M2 milestone Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core An issue in spring-security-core type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants