Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/next-release/bugfix-AWSSDKforJavav2-71c9a16.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "bugfix",
"category": "AWS SDK for Java v2",
"contributor": "",
"description": "Fix a potential NullPointerException that may be thrown when API call timeout is configured"
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ private Exception translatePipelineException(RequestExecutionContext context, Ex
// but before we called timeoutTracker.cancel(). Note that if hasExecuted() returns true, its guaranteed that
// the timeout tracker has set the interrupt flag, and if it returns false, it guarantees that it did not and
// will never set the interrupt flag.
if (context.apiCallAttemptTimeoutTracker().hasExecuted()) {
TimeoutTracker timeoutTracker = context.apiCallAttemptTimeoutTracker();
if (timeoutTracker != null && timeoutTracker.hasExecuted()) {
// Clear the interrupt flag. Since we already have an exception from the call, which may contain information
// that's useful to the caller, just return that instead of an ApiCallTimeoutException.
Thread.interrupted();
Expand All @@ -136,7 +137,8 @@ private RuntimeException handleInterruptedException(RequestExecutionContext cont
"Failed to close the response stream",
r::close));
}
if (context.apiCallAttemptTimeoutTracker().hasExecuted()) {
TimeoutTracker timeoutTracker = context.apiCallAttemptTimeoutTracker();
if (timeoutTracker != null && timeoutTracker.hasExecuted()) {
// Clear the interrupt status
Thread.interrupted();
return generateApiCallAttemptTimeoutException(context);
Expand Down
Loading