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.<init>(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.
This commit is contained in:
catbref 2019-08-02 12:19:55 +01:00
parent 63b262a76e
commit 1094db288e

View File

@ -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");