Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit e44ac4b

Browse files
committed
fixed issue a68
1 parent 5366293 commit e44ac4b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/main/java/com/evanlennick/retry4j/CallExecutor.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,20 @@ private boolean shouldThrowException(Exception e) {
192192
}
193193

194194
//config says to retry only on specific exceptions
195-
for (Class<? extends Exception> exceptionInSet : this.config.getRetryOnSpecificExceptions()) {
196-
if (exceptionInSet.isAssignableFrom(e.getClass())) {
195+
for (Class<? extends Exception> exceptionToRetryOn : this.config.getRetryOnSpecificExceptions()) {
196+
if (exceptionToRetryOn.isAssignableFrom(e.getClass())) {
197197
return false;
198198
}
199199
}
200200

201201
//config says to retry on all except specific exceptions
202-
for (Class<? extends Exception> exceptionInSet : this.config.getRetryOnAnyExceptionExcluding()) {
203-
if (!exceptionInSet.isAssignableFrom(e.getClass())) {
204-
return false;
202+
if (!this.config.getRetryOnAnyExceptionExcluding().isEmpty()) {
203+
for (Class<? extends Exception> exceptionToNotRetryOn : this.config.getRetryOnAnyExceptionExcluding()) {
204+
if (exceptionToNotRetryOn.isAssignableFrom(e.getClass())) {
205+
return true;
206+
}
205207
}
208+
return false;
206209
}
207210

208211
return true;

0 commit comments

Comments
 (0)