Skip to content

Commit 5203b3a

Browse files
Joshua Dowellmgaffigan
authored andcommitted
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 <joshua.dowell@centrallogic.com>
1 parent be058f6 commit 5203b3a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎client/src/com/mirth/connect/client/ui/actions/PasteAction.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@
1717

1818
importjavax.swing.AbstractAction;
1919

20+
importorg.apache.logging.log4j.LogManager;
21+
importorg.apache.logging.log4j.Logger;
22+
2023
importcom.mirth.connect.client.ui.components.MirthTextInterface;
2124

2225
/** Allows for Pasting in text components. */
2326
publicclassPasteActionextendsAbstractAction {
2427

28+
privatestaticfinalLoggerlogger = LogManager.getLogger(PasteAction.class);
2529
MirthTextInterfacecomp;
2630

2731
publicPasteAction(MirthTextInterfacecomp) {
@@ -46,6 +50,9 @@ public boolean isEnabled() {
4650
returnfalse;
4751
} catch (IllegalStateExceptione) {
4852
returnfalse;
53+
} catch (Errore) {
54+
logger.warn("Could not check clipboard contents.", e);
55+
returnfalse;
4956
}
5057
} else {
5158
returnfalse;

0 commit comments

Comments
 (0)