Use logger instead of printing stacktrace

MYC-Refactor
Hammy 3 years ago
parent f570eca8fa
commit 13fdf8fadd

@ -34,8 +34,8 @@ class WindowsOrUnixClipboardListener extends ClipboardListener implements Runnab
Transferable newClipboardContents = oldClipboard.getContents(currentThread()); Transferable newClipboardContents = oldClipboard.getContents(currentThread());
processContents(oldClipboard, oldClipboardContents, newClipboardContents); processContents(oldClipboard, oldClipboardContents, newClipboardContents);
regainOwnership(oldClipboard, newClipboardContents); regainOwnership(oldClipboard, newClipboardContents);
} catch (IllegalStateException | InterruptedException err) { } catch (IllegalStateException | InterruptedException exp) {
err.printStackTrace(); logger.error("Exception Thrown When Processing Clipboard Changes", exp);
executorService.submit(this); executorService.submit(this);
} }
} }
@ -106,7 +106,7 @@ class WindowsOrUnixClipboardListener extends ClipboardListener implements Runnab
try { try {
sleep(200); sleep(200);
} catch (InterruptedException ie) { } catch (InterruptedException ie) {
ie.printStackTrace(); logger.error("Exception Thrown As Thread Cannot Sleep", ie);
} }
listening = false; listening = false;
@ -118,13 +118,13 @@ class WindowsOrUnixClipboardListener extends ClipboardListener implements Runnab
try { try {
sleep(200); sleep(200);
} catch (InterruptedException ie) { } catch (InterruptedException ie) {
ie.printStackTrace(); logger.error("Exception Thrown As Thread Cannot Sleep", ie);
} }
try { try {
clipboard.setContents(new StringSelection(stringContent), this); clipboard.setContents(new StringSelection(stringContent), this);
} catch (IllegalStateException ise) { } catch (IllegalStateException ise) {
ise.printStackTrace(); logger.error("Exception Thrown As Clipboard Cannot Be Accessed", ise);
executorService.submit(this); executorService.submit(this);
} }
} }
@ -134,13 +134,13 @@ class WindowsOrUnixClipboardListener extends ClipboardListener implements Runnab
try { try {
sleep(200); sleep(200);
} catch (InterruptedException ie) { } catch (InterruptedException ie) {
ie.printStackTrace(); logger.error("Exception Thrown As Thread Cannot Sleep", ie);
} }
try { try {
clipboard.setContents(new TransferableImage(imageContent), this); clipboard.setContents(new TransferableImage(imageContent), this);
} catch (IllegalStateException ise) { } catch (IllegalStateException ise) {
ise.printStackTrace(); logger.error("Exception Thrown As Clipboard Cannot Be Accessed", ise);
executorService.submit(this); executorService.submit(this);
} }
} }
@ -150,13 +150,13 @@ class WindowsOrUnixClipboardListener extends ClipboardListener implements Runnab
try { try {
sleep(200); sleep(200);
} catch (InterruptedException ie) { } catch (InterruptedException ie) {
ie.printStackTrace(); logger.error("Exception Thrown As Thread Cannot Sleep", ie);
} }
try { try {
clipboard.setContents(new TransferableFileList(fileContent), this); clipboard.setContents(new TransferableFileList(fileContent), this);
} catch (IllegalStateException ise) { } catch (IllegalStateException ise) {
ise.printStackTrace(); logger.error("Exception Thrown As Clipboard Cannot Be Accessed", ise);
executorService.submit(this); executorService.submit(this);
} }
} }
@ -187,8 +187,8 @@ class WindowsOrUnixClipboardListener extends ClipboardListener implements Runnab
try { try {
Transferable currentClipboardContents = clipboard.getContents(null); Transferable currentClipboardContents = clipboard.getContents(null);
regainOwnership(clipboard, currentClipboardContents); regainOwnership(clipboard, currentClipboardContents);
} catch (IllegalStateException err) { } catch (IllegalStateException ise) {
err.printStackTrace(); logger.error("Exception Thrown When Retrieving Clipboard Contents", ise);
executorService.submit(this); executorService.submit(this);
} }
} }

Loading…
Cancel
Save