From 1094db288e145306d5052ead78c13d33eeb70a5d Mon Sep 17 00:00:00 2001 From: catbref Date: Fri, 2 Aug 2019 12:19:55 +0100 Subject: [PATCH] Catch SystemTray.isSupported errors (and act as if no support). Symptoms were on Ubuntu with 8u222: Exception in thread "Controller" java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper at java.awt.Toolkit.loadAssistiveTechnologies(Toolkit.java:807) at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:886) at java.awt.SystemTray.isSupported(SystemTray.java:219) at org.qora.gui.SysTray.(SysTray.java:50) at org.qora.gui.SysTray.getInstance(SysTray.java:249) at org.qora.controller.Controller.updateSysTray(Controller.java:480) at org.qora.controller.Controller.run(Controller.java:368) (Underlying cause not known) This would cause Controller thread to silently exit, and so no synchronization would occur. Node would still have connections and thus happily generate its own blocks on its on fork. Maybe other peers would try to sync with this node but would likely reject this node's chain after a short while. --- src/main/java/org/qora/gui/SysTray.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/qora/gui/SysTray.java b/src/main/java/org/qora/gui/SysTray.java index 0b10aa92..71c86e42 100644 --- a/src/main/java/org/qora/gui/SysTray.java +++ b/src/main/java/org/qora/gui/SysTray.java @@ -1,5 +1,6 @@ package org.qora.gui; +import java.awt.AWTError; import java.awt.AWTException; import java.awt.SystemTray; import java.awt.TrayIcon; @@ -46,8 +47,13 @@ public class SysTray { private JDialog hiddenDialog = null; private SysTray() { - if (!SystemTray.isSupported()) + try { + if (!SystemTray.isSupported()) + return; + } catch (AWTError e) { + // Even SystemTray.isSupported can fail, so catch that too return; + } LOGGER.info("Launching system tray icon");