File tree Expand file tree Collapse file tree 2 files changed +3
-13
lines changed
main/java/software/amazon/awssdk/retries/api
test/java/software/amazon/awssdk/retries/api Expand file tree Collapse file tree 2 files changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -127,11 +127,10 @@ default B retryOnExceptionOrCause(Class<? extends Throwable> throwable) {
127
127
return true ;
128
128
}
129
129
Throwable cause = t .getCause ();
130
- while (cause != null ) {
130
+ if (cause != null ) {
131
131
if (cause .getClass () == throwable ) {
132
132
return true ;
133
133
}
134
- cause = cause .getCause ();
135
134
}
136
135
return false ;
137
136
});
@@ -147,11 +146,10 @@ default B retryOnExceptionOrCauseInstanceOf(Class<? extends Throwable> throwable
147
146
return true ;
148
147
}
149
148
Throwable cause = t .getCause ();
150
- while (cause != null ) {
149
+ if (cause != null ) {
151
150
if (throwable .isAssignableFrom (cause .getClass ())) {
152
151
return true ;
153
152
}
154
- cause = cause .getCause ();
155
153
}
156
154
return false ;
157
155
});
Original file line number Diff line number Diff line change @@ -58,11 +58,7 @@ static Collection<TestCase> parameters() {
58
58
.expectShouldRetry ()
59
59
, new TestCase ()
60
60
.configure (b -> b .retryOnExceptionOrCause (IllegalArgumentException .class ))
61
- .givenThrowable (new RuntimeException (new RuntimeException (new IllegalArgumentException ())))
62
- .expectShouldRetry ()
63
- , new TestCase ()
64
- .configure (b -> b .retryOnExceptionOrCause (IllegalArgumentException .class ))
65
- .givenThrowable (new RuntimeException (new RuntimeException (new NumberFormatException ())))
61
+ .givenThrowable (new RuntimeException (new NumberFormatException ()))
66
62
.expectShouldNotRetry ()
67
63
, new TestCase ()
68
64
.configure (b -> b .retryOnExceptionInstanceOf (IllegalArgumentException .class ))
@@ -96,10 +92,6 @@ static Collection<TestCase> parameters() {
96
92
.configure (b -> b .retryOnExceptionOrCauseInstanceOf (IllegalArgumentException .class ))
97
93
.givenThrowable (new NumberFormatException ())
98
94
.expectShouldRetry ()
99
- , new TestCase ()
100
- .configure (b -> b .retryOnExceptionOrCauseInstanceOf (IllegalArgumentException .class ))
101
- .givenThrowable (new RuntimeException (new RuntimeException (new NumberFormatException ())))
102
- .expectShouldRetry ()
103
95
);
104
96
}
105
97
You can’t perform that action at this time.
0 commit comments