From 7cf9f09529069c5b48dd40acc704485e7553d0fa Mon Sep 17 00:00:00 2001 From: lucasward Date: Fri, 7 Sep 2007 19:11:50 +0000 Subject: [PATCH] Fixed how OutputSourceItemProcessor handles a null output source. --- .../batch/item/processor/OutputSourceItemProcessor.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/infrastructure/src/main/java/org/springframework/batch/item/processor/OutputSourceItemProcessor.java b/infrastructure/src/main/java/org/springframework/batch/item/processor/OutputSourceItemProcessor.java index 33cad9917..23b0e4054 100644 --- a/infrastructure/src/main/java/org/springframework/batch/item/processor/OutputSourceItemProcessor.java +++ b/infrastructure/src/main/java/org/springframework/batch/item/processor/OutputSourceItemProcessor.java @@ -9,6 +9,7 @@ import org.springframework.batch.restart.GenericRestartData; import org.springframework.batch.restart.RestartData; import org.springframework.batch.restart.Restartable; import org.springframework.batch.statistics.StatisticsProvider; +import org.springframework.util.Assert; /** * Simple wrapper around {@link OutputSource} providing {@link Restartable} and @@ -41,6 +42,9 @@ public class OutputSourceItemProcessor implements ItemProcessor, Restartable, Sk * @see Restartable#getRestartData() */ public RestartData getRestartData() { + + Assert.state(source != null, "Source must not be null."); + if (source instanceof Restartable) { return ((Restartable) source).getRestartData(); } @@ -53,6 +57,9 @@ public class OutputSourceItemProcessor implements ItemProcessor, Restartable, Sk * @see Restartable#restoreFrom(RestartData) */ public void restoreFrom(RestartData data) { + + Assert.state(source != null, "Source must not be null."); + if (source instanceof Restartable) { ((Restartable) source).restoreFrom(data); }