From 637f2a61f6fcab268712d37350b7cffb9dad2aac Mon Sep 17 00:00:00 2001 From: robokaso Date: Wed, 12 Mar 2008 12:36:39 +0000 Subject: [PATCH] IN PROGRESS - issue BATCH-422: Provide ability to specify exception types as well as skip limit in DefaultStepFactoryBean http://jira.springframework.org/browse/BATCH-422 ItemSkipPolicyItemHandler now always rethrows exception - fixed rollbackJob that wasn't really skipping the error item although it was configured to do so. --- .../batch/core/step/ItemSkipPolicyItemHandler.java | 6 ++---- .../src/main/resources/jobs/rollbackJob.xml | 3 +-- .../batch/sample/RollbackJobFunctionalTests.java | 13 +++++++------ 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/ItemSkipPolicyItemHandler.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/ItemSkipPolicyItemHandler.java index da0aa10ad..d6e81221d 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/ItemSkipPolicyItemHandler.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/ItemSkipPolicyItemHandler.java @@ -74,10 +74,8 @@ public class ItemSkipPolicyItemHandler extends SimpleItemHandler { contribution.incrementSkipCount(); skip(); } - else { - // Rethrow so that outer transaction is rolled back properly - throw e; - } + // Rethrow so that outer transaction is rolled back properly + throw e; } diff --git a/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml b/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml index 358df01e2..3d58652e6 100644 --- a/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml @@ -9,13 +9,12 @@ http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> - - + 4 written to output + assertEquals(before + 4, after); } - - + }