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

fix: Redundant NPE in DefaultHttpDestination#equals and #hashCode #368

Merged
merged 2 commits into from
Mar 22, 2024

Conversation

newtork
Copy link
Contributor

@newtork newtork commented Mar 22, 2024

Follow-up from #341

Not critical, since NPE is being caught by default.
However it's easily possible to avoid throwing the exception.

if( ks == null ) {
return new Certificate[0];
}

final ArrayList<Certificate> out = new ArrayList<>();
try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(minor) for which cases do we actually need the try here? Is there any legitimate failure case we need to handle?

Copy link
Contributor Author

@newtork newtork Mar 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Everything" on KeyStore is prone to exceptions being thrown, especially since we never know what kind of implementation is running internally. That's why we need a try.

Example (independent from implementation)

  • KeyStoreException("Uninitialized keystore") if KeyStore was not load-ed.

@newtork newtork added please merge Request to merge a pull request please review Request to review a pull request labels Mar 22, 2024
@MatKuhr MatKuhr merged commit ce0d362 into main Mar 22, 2024
16 checks passed
@MatKuhr MatKuhr deleted the fix/redundant-npe branch March 22, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
please merge Request to merge a pull request please review Request to review a pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants