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 FaultTolerance.run() causing a NPE in async mode #991

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

Ladicek
Copy link
Contributor

@Ladicek Ladicek commented Mar 25, 2024

The previous implementation of FaultTolerance.run() simply delegated to call() with a Callable that produces null. In the async mode, the null is treated as a valid CompletionStage, which immediately results in a NPE. That NPE is subsequently caught and transformed into a failed CompletionStage, but it's better to not throw it at all.

To be able to do this, the internal SPI AsyncSupport gains a new method that is able to create an already complete instance of the async type.

The previous implementation of `FaultTolerance.run()` simply delegated
to `call()` with a `Callable` that produces `null`. In the async mode,
the `null` is treated as a valid `CompletionStage`, which immediately
results in a NPE. That NPE is subsequently caught and transformed into
a failed `CompletionStage`, but it's better to not throw it at all.

To be able to do this, the internal SPI `AsyncSupport` gains a new method
that is able to create an already complete instance of the async type.
@Ladicek Ladicek added this to the 6.3.0 milestone Mar 25, 2024
@Ladicek Ladicek merged commit a218dbb into smallrye:main Mar 25, 2024
10 checks passed
@Ladicek Ladicek deleted the fix-fault-tolerance-run-npe branch March 25, 2024 14:50
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.

1 participant