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
import javax.swing.AbstractAction;
1919

20+
import org.apache.logging.log4j.LogManager;
21+
import org.apache.logging.log4j.Logger;
22+
2023
import com.mirth.connect.client.ui.components.MirthTextInterface;
2124

2225
/** Allows for Pasting in text components. */
2326
public class PasteAction extends AbstractAction {
2427

28+
private static final Logger logger = LogManager.getLogger(PasteAction.class);
2529
MirthTextInterface comp;
2630

2731
public PasteAction(MirthTextInterface comp) {
@@ -46,6 +50,9 @@ public boolean isEnabled() {
4650
return false;
4751
} catch (IllegalStateException e) {
4852
return false;
53+
} catch (Error e) {
54+
logger.warn("Could not check clipboard contents.", e);
55+
return false;
4956
}
5057
} else {
5158
return false;

0 commit comments

Comments
 (0)