Skip to content

Commit 359978d

Browse files
committed
added null check to avoid NPE when the user has not specified a collector
1 parent 1a0af61 commit 359978d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

marklogic-data-hub/src/main/java/com/marklogic/spring/batch/hub/CollectorReader.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.marklogic.spring.batch.hub;
22

3+
import java.util.ArrayList;
34
import java.util.List;
45

56
import org.springframework.batch.item.ExecutionContext;
@@ -26,7 +27,12 @@ public CollectorReader(Collector collector) {
2627

2728
@Override
2829
public void open(ExecutionContext executionContext) throws ItemStreamException {
29-
this.results = collector.run();
30+
if (collector != null) {
31+
this.results = collector.run();
32+
}
33+
else {
34+
this.results = new ArrayList<>();
35+
}
3036
}
3137

3238
@Override

0 commit comments

Comments
 (0)