-
Notifications
You must be signed in to change notification settings - Fork 910
[UrlConnectionHttpClient] Wrap erroneous NPE from HttpURLConnection as IOException #2572
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…s IOException ## Motivation `HttpURLConnection#getInputStream0` has been observed to intermittently throw `NullPointerException`s for reasons that still require further investigation, but are assumed to be due to a bug in the JDK. Propagating such NPEs is confusing for users and are not subject to being retried on by the default retry policy configuration, so instead we should bias towards propagating these as `IOException`s. ## Modifications * When interacting specifically with HttpURLConnection#getResponseCode, wrap any unexpected NullPointerExceptions as IOException * Add corresponding unit test ## Result * Transient errors will be retried and be less likely to surface to a user's application layer
…s IOException ## Motivation `HttpURLConnection#getInputStream0` has been observed to intermittently throw `NullPointerException`s for reasons that still require further investigation, but are assumed to be due to a bug in the JDK. Propagating such NPEs is confusing for users and are not subject to being retried on by the default retry policy configuration, so instead we should bias towards propagating these as `IOException`s. ## Modifications * When interacting specifically with HttpURLConnection#getResponseCode, wrap any unexpected NullPointerExceptions as IOException * Add corresponding unit test ## Result * Transient errors will be retried and be less likely to surface to a user's application layer
dagnir
reviewed
Jun 30, 2021
...-client/src/main/java/software/amazon/awssdk/http/urlconnection/UrlConnectionHttpClient.java
Show resolved
Hide resolved
…s IOException ## Motivation `HttpURLConnection#getInputStream0` has been observed to intermittently throw `NullPointerException`s for reasons that still require further investigation, but are assumed to be due to a bug in the JDK. Propagating such NPEs is confusing for users and are not subject to being retried on by the default retry policy configuration, so instead we should bias towards propagating these as `IOException`s. ## Modifications * When interacting specifically with HttpURLConnection#getResponseCode, wrap any unexpected NullPointerExceptions as IOException * Add corresponding unit test ## Result * Transient errors will be retried and be less likely to surface to a user's application layer
dagnir
approved these changes
Jun 30, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kudos, SonarCloud Quality Gate passed! |
@all-contributors please add @Bennett-Lynch for code |
I've put up a pull request to add @Bennett-Lynch! 🎉 |
aws-sdk-java-automation
added a commit
that referenced
this pull request
May 25, 2023
…df6262e5e Pull request: release <- staging/d3d243dd-2120-42f9-9b7a-e92df6262e5e
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
wrap any unexpected NullPointerExceptions as IOException
Motivation and Context
HttpURLConnection#getInputStream0
has been observed to intermittentlythrow
NullPointerException
s for reasons that still require furtherinvestigation, but are assumed to be due to a bug in the JDK.
Propagating such NPEs is confusing for users and are not subject to
being retried on by the default retry policy configuration, so instead
we should bias towards propagating these as
IOException
s.Testing
Created new unit test to simulate the observed (but not yet reliably reproduced) behavior of HttpURLConnection throwing NPE.
Types of changes
Checklist
mvn install
succeedsLicense