diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStep.java index d62e71904..fdf90a2cf 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStep.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStep.java @@ -272,10 +272,7 @@ public abstract class AbstractStep implements Step, InitializingBean, BeanNameAw * Determine the step status based on the exception. */ private static BatchStatus determineBatchStatus(Throwable e) { - if (e instanceof FatalException) { - return BatchStatus.UNKNOWN; - } - else if (e instanceof JobInterruptedException || e.getCause() instanceof JobInterruptedException) { + if (e instanceof JobInterruptedException || e.getCause() instanceof JobInterruptedException) { return BatchStatus.STOPPED; } else { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/FatalException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/FatalException.java deleted file mode 100644 index 11b299b86..000000000 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/FatalException.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.springframework.batch.core.step; - -import org.springframework.batch.core.BatchStatus; -import org.springframework.batch.core.UnexpectedJobExecutionException; - -/** - * Signals a fatal exception in step - e.g. unable to persist batch metadata or - * rollback transaction. Throwing this exception in a step implementation will - * result in the step having a status of {@link BatchStatus#UNKNOWN}. - */ -public class FatalException extends UnexpectedJobExecutionException { - - public FatalException(String string, Throwable e) { - super(string, e); - } - - public FatalException(String string) { - super(string); - } -} \ No newline at end of file diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBean.java index 8dc650afb..061b328a3 100755 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBean.java @@ -28,7 +28,6 @@ import org.springframework.batch.classify.Classifier; import org.springframework.batch.classify.SubclassClassifier; import org.springframework.batch.core.JobInterruptedException; import org.springframework.batch.core.Step; -import org.springframework.batch.core.step.FatalException; import org.springframework.batch.core.step.skip.LimitCheckingItemSkipPolicy; import org.springframework.batch.core.step.skip.NonSkippableReadException; import org.springframework.batch.core.step.skip.SkipLimitExceededException; @@ -294,9 +293,9 @@ public class FaultTolerantStepFactoryBean extends SimpleStepFactoryBean, Boolean> skippable = getExceptionClasses("s1", chunkElementParentAttributeParserTestsContext); - assertEquals(12, skippable.size()); + assertEquals(11, skippable.size()); containsClassified(skippable, NullPointerException.class, true); containsClassified(skippable, ArithmeticException.class, true); containsClassified(skippable, CannotAcquireLockException.class, false); @@ -61,7 +61,7 @@ public class ChunkElementParserTests { public void testInheritSkippableWithNoMerge() throws Exception { Map, Boolean> skippable = getExceptionClasses("s2", chunkElementParentAttributeParserTestsContext); - assertEquals(10, skippable.size()); + assertEquals(9, skippable.size()); containsClassified(skippable, NullPointerException.class, true); assertFalse(skippable.containsKey(ArithmeticException.class)); containsClassified(skippable, CannotAcquireLockException.class, false); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests.java index 8c3bcde5c..cd856f4ab 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests.java @@ -21,7 +21,6 @@ import org.springframework.batch.core.repository.JobExecutionAlreadyRunningExcep import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.JobRestartException; -import org.springframework.batch.core.step.FatalException; import org.springframework.beans.BeansException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; @@ -122,15 +121,6 @@ public class FaultTolerantExceptionClassesTests implements ApplicationContextAwa assertEquals("[]", writer.getCommitted().toString()); } - @Test - public void testInternalFatalChecked() throws Exception { - writer.setExceptionType(FatalException.class); - StepExecution stepExecution = launchStep("skippableFatalStep"); - assertEquals(BatchStatus.UNKNOWN, stepExecution.getStatus()); - assertEquals("[1, 2, 3]", writer.getWritten().toString()); - assertEquals("[]", writer.getCommitted().toString()); - } - @Test public void testSkippableChecked() throws Exception { writer.setExceptionType(SkippableException.class); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletStepTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletStepTests.java index 91689a8e1..ff1e0cafd 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletStepTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletStepTests.java @@ -371,8 +371,7 @@ public class TaskletStepTests { step.execute(stepExecution); Throwable e = stepExecution.getFailureExceptions().get(0); - assertEquals("Fatal failure detected", e.getMessage()); - assertEquals("foo", e.getCause().getMessage()); + assertEquals("foo", e.getMessage()); assertEquals(BatchStatus.UNKNOWN, stepExecution.getStatus()); }