Fixed how OutputSourceItemProcessor handles a null output source.

This commit is contained in:
lucasward
2007-09-07 19:11:50 +00:00
parent 481c5f0941
commit 7cf9f09529

View File

@@ -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);
}