Some various simple fixes
* Fix `SimpleRetryPolicy` for NPE when `context.getLastThrowable()` is `null` Set `NO_RECOVERY` if it cannot retry and that exception is null * Fix `RecoverAnnotationRecoveryHandlerTests` for a proper return value in the composite `recoverByComposedRetryableAnnotationName` annotation test
This commit is contained in:
@@ -210,7 +210,7 @@ public class SimpleRetryPolicy implements RetryPolicy {
|
||||
public boolean canRetry(RetryContext context) {
|
||||
Throwable t = context.getLastThrowable();
|
||||
boolean can = (t == null || retryForException(t)) && context.getRetryCount() < getMaxAttempts();
|
||||
if (!can && !this.recoverableClassifier.classify(t)) {
|
||||
if (!can && t != null && !this.recoverableClassifier.classify(t)) {
|
||||
context.setAttribute(RetryContext.NO_RECOVERY, true);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
* @author Randell Callahan
|
||||
* @author Nathanaël Roberts
|
||||
* @author Maksim Kita
|
||||
* @Author Gianluca Medici
|
||||
* @author Gianluca Medici
|
||||
*/
|
||||
public class RecoverAnnotationRecoveryHandlerTests {
|
||||
|
||||
@@ -661,7 +661,7 @@ public class RecoverAnnotationRecoveryHandlerTests {
|
||||
}
|
||||
|
||||
public int barRecover(Throwable throwable, String name) {
|
||||
return 2;
|
||||
return 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user