Skip to content

Commit 448a8bd

Browse files
authored
Merge pull request #350 from skalarproduktraum/defaultioservice-warnings
DefaultIOService: Notify in case suitable IOPlugins could not be found.
2 parents ee76b7c + 9a1b86a commit 448a8bd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/main/java/org/scijava/io/DefaultIOService.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,16 @@ public final class DefaultIOService
6464
@Override
6565
public Object open(final String source) throws IOException {
6666
final IOPlugin<?> opener = getOpener(source);
67-
if (opener == null) return null; // no appropriate IOPlugin
67+
if (opener == null) {
68+
log.error("No opener IOPlugin found for " + source + ".");
69+
return null;
70+
}
6871

6972
final Object data = opener.open(source);
70-
if (data == null) return null; // IOPlugin returned no data; canceled?
73+
if (data == null) {
74+
log.warn("Opener IOPlugin " + opener + " returned no data. Canceled?");
75+
return null; // IOPlugin returned no data; canceled?
76+
}
7177

7278
eventService.publish(new DataOpenedEvent(source, data));
7379
return data;
@@ -81,6 +87,8 @@ public void save(final Object data, final String destination)
8187
if (saver != null) {
8288
saver.save(data, destination);
8389
eventService.publish(new DataSavedEvent(destination, data));
90+
} else {
91+
log.error("No Saver IOPlugin found for " + data.toString() + ".");
8492
}
8593
}
8694
}

0 commit comments

Comments
 (0)