Skip to content

Commit 5490ab3

Browse files
committed
FileBatchService: add check for compatible inputs
1 parent 11c21f7 commit 5490ab3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/org/scijava/batch/FileBatchService.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import org.scijava.Priority;
77
import org.scijava.command.CommandService;
8+
import org.scijava.log.LogService;
89
import org.scijava.module.ModuleInfo;
910
import org.scijava.plugin.Parameter;
1011
import org.scijava.plugin.Plugin;
@@ -15,6 +16,9 @@
1516
public final class FileBatchService extends AbstractService implements
1617
BatchService {
1718

19+
@Parameter
20+
private LogService log;
21+
1822
@Parameter
1923
private CommandService commandService;
2024

@@ -28,6 +32,11 @@ public boolean supports(Class<?> type) {
2832

2933
@Override
3034
public void run(ModuleInfo moduleInfo) {
35+
// check if moduleInfo has batchable inputs
36+
if (batchableInputs(moduleInfo).isEmpty()) {
37+
log.error("No compatible inputs (of type File) found.");
38+
return;
39+
}
3140
// Call ModuleBatchProcessor with input moduleInfo
3241
HashMap<String, Object> inputMap = new HashMap<>();
3342
inputMap.put("moduleInfo", moduleInfo);

0 commit comments

Comments
 (0)