From a0f04b2f6b992a737e962c9a7d8f7b5a5076c89b Mon Sep 17 00:00:00 2001 From: Karl Duderstadt Date: Fri, 26 Feb 2021 16:47:30 +0100 Subject: [PATCH] Fix issue #406 without a location call handler supportsOpen(string) This commit fixes an issue caused by calling the Location version of the method supportsOpen() in all cases when many IOPlugin do not yet implement that Location version of that method and therefore always return false. Instead now IOService getOpener(string) directly calls the string version of supportsOpen. This ensures older IOPlugin that can support the file provided are discovered and used. --- src/main/java/org/scijava/io/IOService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/scijava/io/IOService.java b/src/main/java/org/scijava/io/IOService.java index 0d6ad9340..ea6d94037 100644 --- a/src/main/java/org/scijava/io/IOService.java +++ b/src/main/java/org/scijava/io/IOService.java @@ -50,7 +50,10 @@ public interface IOService extends HandlerService>, * location. */ default IOPlugin getOpener(final String source) { - return getOpener(new FileLocation(source)); + for (final IOPlugin handler : getInstances()) { + if (handler.supportsOpen(source)) return handler; + } + return null; } /**