Skip to content

Commit 41a8b3d

Browse files
committed
Catch potential unavailable clipboard exception
1 parent b0a3536 commit 41a8b3d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

core/src/org/testar/monkey/alayer/actions/PasteText.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@ public void run(SUT system, State state, double duration) throws ActionFailedExc
7171
StringSelection selection = new StringSelection(inputText);
7272

7373
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
74-
clipboard.setContents(selection, null);
74+
75+
try {
76+
clipboard.setContents(selection, null);
77+
} catch (IllegalStateException ise) {
78+
throw new ActionFailedException("PasteText action execution failed due to currently unavailable clipboard!", ise);
79+
}
7580

7681
system.get(Tags.StandardKeyboard).paste();
7782
}

0 commit comments

Comments
 (0)