diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java index ea2bf7112..d5593b7af 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java @@ -195,8 +195,8 @@ public class ItemOrientedStep extends AbstractStep implements InitializingBean { ((RepeatTemplate) chunkOperations).setCompletionPolicy(new SimpleCompletionPolicy(commitInterval)); } - if (this.chunkOperations instanceof RepeatTemplate && exceptionHandler != null) { - ((RepeatTemplate) chunkOperations).setExceptionHandler(exceptionHandler); + if (this.stepOperations instanceof RepeatTemplate && exceptionHandler != null) { + ((RepeatTemplate) stepOperations).setExceptionHandler(exceptionHandler); } } diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/ItemOrientedStepTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/ItemOrientedStepTests.java index 75d63aa7f..ca8518aed 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/ItemOrientedStepTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/ItemOrientedStepTests.java @@ -355,7 +355,7 @@ public class ItemOrientedStepTests extends TestCase { public void testApplyConfigurationWithExceptionHandler() throws Exception { final List list = new ArrayList(); - itemOrientedStep.setChunkOperations(new RepeatTemplate() { + itemOrientedStep.setStepOperations(new RepeatTemplate() { public void setExceptionHandler(ExceptionHandler exceptionHandler) { list.add(exceptionHandler); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/exception/handler/SimpleLimitExceptionHandler.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/exception/handler/SimpleLimitExceptionHandler.java index f708e2583..4e9221487 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/exception/handler/SimpleLimitExceptionHandler.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/exception/handler/SimpleLimitExceptionHandler.java @@ -19,7 +19,6 @@ package org.springframework.batch.repeat.exception.handler; import java.util.HashMap; import org.springframework.batch.common.ExceptionClassifierSupport; -import org.springframework.batch.io.exception.WriteFailureException; import org.springframework.batch.repeat.RepeatContext; /** @@ -32,14 +31,13 @@ import org.springframework.batch.repeat.RepeatContext; public class SimpleLimitExceptionHandler implements ExceptionHandler { /** - * Name of exception classifier key for the - * {@link WriteFailureException}. + * Name of exception classifier key for the nominated exception type. */ private static final String TX_INVALID = "TX_INVALID"; private RethrowOnThresholdExceptionHandler delegate = new RethrowOnThresholdExceptionHandler(); - private Class type = WriteFailureException.class; + private Class type = Exception.class; /** * Flag to indicate the the exception counters should be shared between @@ -102,7 +100,7 @@ public class SimpleLimitExceptionHandler implements ExceptionHandler { /** * Setter for the Throwable type that this handler counts. Defaults to - * {@link WriteFailureException}. + * {@link Exception}. * * @param type */ diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/exception/handler/SimpleLimitExceptionHandlerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/exception/handler/SimpleLimitExceptionHandlerTests.java index d75d3d089..25715e653 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/exception/handler/SimpleLimitExceptionHandlerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/exception/handler/SimpleLimitExceptionHandlerTests.java @@ -55,7 +55,7 @@ public class SimpleLimitExceptionHandlerTests extends TestCase { } /** - * Other than TransactionInvalidException should be rethrown, ignoring the + * Other than nominated exception type should be rethrown, ignoring the * exception limit. * * @throws Exception @@ -65,6 +65,7 @@ public class SimpleLimitExceptionHandlerTests extends TestCase { final int MORE_THAN_ZERO = 1; handler.setLimit(MORE_THAN_ZERO); + handler.setType(IllegalArgumentException.class); try { handler.handleException(new RepeatContextSupport(null), throwable); diff --git a/spring-batch-samples/src/main/resources/jobs/hibernateJob.xml b/spring-batch-samples/src/main/resources/jobs/hibernateJob.xml index a57e1c60f..2eca9cb99 100644 --- a/spring-batch-samples/src/main/resources/jobs/hibernateJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/hibernateJob.xml @@ -34,16 +34,6 @@ ref="hibernateOutputSource" /> - - - - - - - diff --git a/spring-batch-samples/src/main/resources/jobs/restartSample.xml b/spring-batch-samples/src/main/resources/jobs/restartSample.xml index b86f5b166..49971f33c 100644 --- a/spring-batch-samples/src/main/resources/jobs/restartSample.xml +++ b/spring-batch-samples/src/main/resources/jobs/restartSample.xml @@ -31,6 +31,11 @@ + + + + + diff --git a/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml b/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml index 84b888c2a..43e8903fe 100644 --- a/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml @@ -35,12 +35,6 @@ ref="tradeValidator" /> - - - - -