Skip to content

Commit be56f14

Browse files
authored
Fix NPE in RetryPolicy.hashCode() (#2672)
1 parent e964b1c commit be56f14

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"category": "AWS SDK for Java v2",
3+
"contributor": "",
4+
"type": "bugfix",
5+
"description": "Fix `NullPointerException` in `RetryPolicy.hashCode()`."
6+
}

core/sdk-core/src/main/java/software/amazon/awssdk/core/retry/RetryPolicy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public int hashCode() {
234234
result = 31 * result + Boolean.hashCode(additionalRetryConditionsAllowed);
235235
result = 31 * result + backoffStrategy.hashCode();
236236
result = 31 * result + throttlingBackoffStrategy.hashCode();
237-
result = 31 * result + Boolean.hashCode(fastFailRateLimiting);
237+
result = 31 * result + Objects.hashCode(fastFailRateLimiting);
238238
return result;
239239
}
240240

core/sdk-core/src/test/java/software/amazon/awssdk/core/retry/RetryPolicyTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,9 @@ public void fastFailRateLimitingConfigured_retryModeNotAdaptive_throws() {
180180
public void fastFailRateLimitingConfigured_retryModeAdaptive_doesNotThrow() {
181181
RetryPolicy.builder(RetryMode.ADAPTIVE).fastFailRateLimiting(true).build();
182182
}
183+
184+
@Test
185+
public void hashCodeDoesNotThrow() {
186+
RetryPolicy.defaultRetryPolicy().hashCode();
187+
}
183188
}

0 commit comments

Comments
 (0)