From f09926c28019d328c95d7174d1be560e77e75da7 Mon Sep 17 00:00:00 2001 From: Joshua Dowell Date: Thu, 2 Apr 2026 13:19:21 -0500 Subject: [PATCH] fix: handle clipboard Error when image is in clipboard (#196) Catch Error (e.g. IllegalAccessError from JAI's PNMImageWriter) thrown during clipboard inspection in PasteAction.isEnabled(), log a warning, and return false instead of crashing the Admin UI on login. Signed-off-by: Joshua Dowell --- .../com/mirth/connect/client/ui/actions/PasteAction.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/src/com/mirth/connect/client/ui/actions/PasteAction.java b/client/src/com/mirth/connect/client/ui/actions/PasteAction.java index 14b4da4c75..0952db94a2 100644 --- a/client/src/com/mirth/connect/client/ui/actions/PasteAction.java +++ b/client/src/com/mirth/connect/client/ui/actions/PasteAction.java @@ -17,11 +17,15 @@ import javax.swing.AbstractAction; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + import com.mirth.connect.client.ui.components.MirthTextInterface; /** Allows for Pasting in text components. */ public class PasteAction extends AbstractAction { + private static final Logger logger = LogManager.getLogger(PasteAction.class); MirthTextInterface comp; public PasteAction(MirthTextInterface comp) { @@ -46,6 +50,9 @@ public boolean isEnabled() { return false; } catch (IllegalStateException e) { return false; + } catch (Error e) { + logger.warn("Could not check clipboard contents.", e); + return false; } } else { return false;