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

Unjustified NullPointerException thrown by RiCache.getAll(Set) #80

Open
StraxGasser opened this issue Dec 19, 2022 · 0 comments
Open

Unjustified NullPointerException thrown by RiCache.getAll(Set) #80

StraxGasser opened this issue Dec 19, 2022 · 0 comments

Comments

@StraxGasser
Copy link

StraxGasser commented Dec 19, 2022

RiCache.getAll checks the argument "keys" with keys.contains(null). This check throws a NulllPointerException irrespective of the actual sets elements if the java.util.Set Implementation won't accept null as an element.

java.util.Set.contains documents that the method will throw a NullPointerException "if the specified element is null and this set does not permit null elements". Such Set can easily be obtained by a call to java.util.Collections.unmodifiableSet() or from objects of TreeSet (and possibly other implementations).

Ensuring that the argument "keys" won't contain any null elements should certainly throw a NullPointerException only if the Set happens to actually contain some null-Elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant