From 6d486eb1cb2e5382319a8ce01ba28a01f8c09850 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Thu, 24 Sep 2020 17:03:43 +0200 Subject: [PATCH] Catching unexpected exceptions in batch --- .../java/releaser/internal/spring/SpringBatchFlowRunner.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/releaser-spring/src/main/java/releaser/internal/spring/SpringBatchFlowRunner.java b/releaser-spring/src/main/java/releaser/internal/spring/SpringBatchFlowRunner.java index d13450f2..1c56c370 100644 --- a/releaser-spring/src/main/java/releaser/internal/spring/SpringBatchFlowRunner.java +++ b/releaser-spring/src/main/java/releaser/internal/spring/SpringBatchFlowRunner.java @@ -49,6 +49,7 @@ import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.StepExecutionListener; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.configuration.annotation.JobBuilderFactory; import org.springframework.batch.core.configuration.annotation.StepBuilderFactory; import org.springframework.batch.core.job.builder.FlowBuilder; @@ -423,7 +424,7 @@ class SpringBatchFlowRunner implements FlowRunner, Closeable { List thrownExceptions = exceptionsThrownBySteps(execution); return new ExecutionResult(thrownExceptions); } - catch (JobExecutionException ex) { + catch (JobExecutionException | UnexpectedJobExecutionException ex) { return ExecutionResult.failure(ex); } }