From aeadf8b02ed2ca021714390615cd12e1ca201930 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Mon, 21 Mar 2011 09:26:48 +0000 Subject: [PATCH] BATCH-1717: catch and rethrow to protect against retry infinite loop --- ...t.xml => ChunkElementLateBindingParserTests-context.xml} | 0 .../springframework/batch/retry/support/RetryTemplate.java | 6 +++++- 2 files changed, 5 insertions(+), 1 deletion(-) rename spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/{ChunkElementCommitIntervalParserTests-context.xml => ChunkElementLateBindingParserTests-context.xml} (100%) diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementCommitIntervalParserTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementLateBindingParserTests-context.xml similarity index 100% rename from spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementCommitIntervalParserTests-context.xml rename to spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementLateBindingParserTests-context.xml diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/support/RetryTemplate.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/support/RetryTemplate.java index aaa372f8b..b91691321 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/support/RetryTemplate.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/support/RetryTemplate.java @@ -245,7 +245,11 @@ public class RetryTemplate implements RetryOperations { doOnErrorInterceptors(retryCallback, context, e); - registerThrowable(retryPolicy, state, context, e); + try { + registerThrowable(retryPolicy, state, context, e); + } catch (Exception ex) { + throw new TerminatedRetryException("Terminated retry after error in policy", ex); + } if (canRetry(retryPolicy, context) && !context.isExhaustedOnly()) { try {