Skip to content

Commit 2b73a8a

Browse files
committed
Emit debug messages if Platform#open(URL) fails
1 parent 0788f72 commit 2b73a8a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/main/java/org/scijava/platform/DefaultPlatform.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
import java.net.URL;
3434

3535
import org.scijava.Priority;
36+
import org.scijava.log.LogService;
37+
import org.scijava.plugin.Parameter;
3638
import org.scijava.plugin.Plugin;
3739

3840
/**
@@ -44,6 +46,9 @@
4446
@Plugin(type = Platform.class, name = "Default", priority = Priority.VERY_LOW)
4547
public class DefaultPlatform extends AbstractPlatform {
4648

49+
@Parameter(required = false)
50+
private LogService log;
51+
4752
// -- PlatformHandler methods --
4853

4954
/**
@@ -66,9 +71,14 @@ public void open(final URL url) throws IOException {
6671
try {
6772
final int exitCode = getPlatformService().exec(browser, url.toString());
6873
if (exitCode == 0) return;
74+
else if (log != null) {
75+
log.debug("Command '" + browser +
76+
"' failed with exit code " + exitCode);
77+
}
6978
}
7079
catch (final IOException e) {
7180
// browser executable was invalid; try the next one
81+
if (log != null) log.debug("Command '" + browser + "' failed", e);
7282
}
7383
}
7484
throw new IOException("Could not open " + url);

0 commit comments

Comments
 (0)