Skip to content

Commit 065250a

Browse files
authored
Merge pull request #17 from siri-varma/users/svegiraju/fix-npe
Make sure IllegalArgumentException is thrown when Null value is being set for setRetryTimeout
2 parents 5880cda + 4a2a08e commit 065250a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

client/src/main/java/io/dapr/durabletask/RetryPolicy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ public RetryPolicy setMaxRetryInterval(@Nullable Duration maxRetryInterval) {
109109
* @return this retry policy object
110110
*/
111111
public RetryPolicy setRetryTimeout(Duration retryTimeout) {
112-
if (retryTimeout != null && retryTimeout.compareTo(this.firstRetryInterval) < 0) {
113-
throw new IllegalArgumentException("The value for retryTimeout must be greater than or equal to the value for firstRetryInterval.");
112+
if (retryTimeout == null || retryTimeout.compareTo(this.firstRetryInterval) < 0) {
113+
throw new IllegalArgumentException("The value for retryTimeout cannot be null and must be greater than or equal to the value for firstRetryInterval.");
114114
}
115115
this.retryTimeout = retryTimeout;
116116
return this;

client/src/main/java/io/dapr/durabletask/TaskOrchestrationExecutor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,10 +1165,14 @@ public V await() {
11651165

11661166
private boolean shouldRetry() {
11671167
if (this.lastFailure.isNonRetriable()) {
1168-
return false;
1168+
logger.warning("Not performing any retries because the error is non retriable");
1169+
1170+
return false;
11691171
}
11701172

11711173
if (this.policy != null) {
1174+
logger.warning("Performing retires based on policy");
1175+
11721176
return this.shouldRetryBasedOnPolicy();
11731177
} else if (this.handler != null) {
11741178
RetryContext retryContext = new RetryContext(
@@ -1184,6 +1188,8 @@ private boolean shouldRetry() {
11841188
}
11851189

11861190
private boolean shouldRetryBasedOnPolicy() {
1191+
logger.warning(this.attemptNumber + " retries out of total %d performed " + this.policy.getMaxNumberOfAttempts());
1192+
11871193
if (this.attemptNumber >= this.policy.getMaxNumberOfAttempts()) {
11881194
// Max number of attempts exceeded
11891195
return false;

0 commit comments

Comments
 (0)