Skip to content

Commit

Permalink
[#561] DashboardServer: Desktop#isDesktopSupported passes on headless…
Browse files Browse the repository at this point in the history
… systems (#580)

`Desktop.isDesktopSupported()` is used in the DashboardServer to check
for the Desktop environment prior to the launching of dashboard.

However, in a headless system, this check will return true
irregardless, resulting in an uncaught run time exception to be thrown.

To ensure that this action is truly supported by the executing
environment, let's add an additional condition to ensure that the
instance supports browsing action.
  • Loading branch information
fzdy1914 authored and yamidark committed Mar 7, 2019
1 parent 741c36e commit c1134fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/reposense/system/DashboardServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static void startServer(int port, Path requestPath) {
*/
private static void launchBrowser(String url) throws IOException {
try {
if (Desktop.isDesktopSupported()) {
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
Desktop.getDesktop().browse(new URI(url));
logger.info("Loading " + url + " on the default browser...");
} else {
Expand Down

0 comments on commit c1134fc

Please sign in to comment.