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

[#343] Fix for: NullpointerException WebApplicationException when Response Headers not set #348

Merged
merged 2 commits into from
Jan 29, 2024

Conversation

lwitkowski
Copy link
Collaborator

Fixes #343

.getHeaders()
.forEach((header, values) -> values.forEach(value -> problem.withHeader(header, value)));
Optional.ofNullable(exception.getResponse().getHeaders())
.ifPresent(headers -> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

ifPresent is passe (right from the design) 😉

Prefer

Optional.ofNullable(...).orElse(<empty>).forEach(h -> ...)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ifPresent != isPresent :P I see nothing wrong with ifPresent, it's much more readable (and obvious) than e.g flatMap for most developers, including me...

Copy link
Collaborator

@pazkooda pazkooda left a comment

Choose a reason for hiding this comment

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

Small detail, but otherwise look good.

@lwitkowski lwitkowski merged commit 7dc6760 into master Jan 29, 2024
6 checks passed
@lwitkowski lwitkowski deleted the bug/343 branch January 29, 2024 21:05
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

Successfully merging this pull request may close these issues.

NullpointerException WebApplicationException when Response Headers not set
2 participants