Added proper logging for exceptions. Code polish

This commit is contained in:
nathan 2016-09-27 00:51:28 +02:00
parent 34588de6b7
commit 9d46adf3f1

View File

@ -115,7 +115,7 @@ class SystemTray {
* <p> * <p>
* This is an advanced feature, and it is recommended to leave at 0. * This is an advanced feature, and it is recommended to leave at 0.
*/ */
public static int FORCE_TRAY_TYPE = 3; public static int FORCE_TRAY_TYPE = 0;
@Property @Property
/** /**
@ -880,7 +880,7 @@ class SystemTray {
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); logger.error("Error updating menu entry: {}, with text {}", origMenuText, newMenuText);
} }
if (!hasValue.get()) { if (!hasValue.get()) {
@ -925,7 +925,7 @@ class SystemTray {
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); logger.error("Error updating menu entry: {}, with image {}", origMenuText, imagePath);
} }
if (!hasValue.get()) { if (!hasValue.get()) {
@ -971,7 +971,7 @@ class SystemTray {
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); logger.error("Error updating menu entry: {}, with image URL {}", origMenuText, imageUrl.getPath());
} }
if (!hasValue.get()) { if (!hasValue.get()) {
@ -1016,7 +1016,7 @@ class SystemTray {
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); logger.error("Error updating menu entry: {}, with image stream (named) {}", origMenuText, cacheName);
} }
if (!hasValue.get()) { if (!hasValue.get()) {
@ -1062,7 +1062,7 @@ class SystemTray {
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); logger.error("Error updating menu entry: {}, with iamgeStream {}", origMenuText);
} }
if (!hasValue.get()) { if (!hasValue.get()) {
@ -1107,7 +1107,7 @@ class SystemTray {
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); logger.error("Error updating menu entry: {}, with new callback", origMenuText);
} }
if (!hasValue.get()) { if (!hasValue.get()) {
@ -1155,7 +1155,7 @@ class SystemTray {
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); logger.error("Error updating menu entry: {}, with text and callback {}", origMenuText, newMenuText);
} }
if (!hasValue.get()) { if (!hasValue.get()) {
@ -1215,7 +1215,7 @@ class SystemTray {
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); logger.error("Error removing menu entry: {}", label);
} }
if (!hasValue.get()) { if (!hasValue.get()) {
@ -1235,10 +1235,6 @@ class SystemTray {
final CountDownLatch countDownLatch = new CountDownLatch(1); final CountDownLatch countDownLatch = new CountDownLatch(1);
final AtomicBoolean hasValue = new AtomicBoolean(true); final AtomicBoolean hasValue = new AtomicBoolean(true);
dispatch(new Runnable() {
@Override
public
void run() {
dispatch(new Runnable() { dispatch(new Runnable() {
@Override @Override
public public
@ -1256,8 +1252,6 @@ class SystemTray {
countDownLatch.countDown(); countDownLatch.countDown();
} }
}); });
}
});
try { try {
if (!countDownLatch.await(TIMEOUT, TimeUnit.SECONDS)) { if (!countDownLatch.await(TIMEOUT, TimeUnit.SECONDS)) {
@ -1266,7 +1260,7 @@ class SystemTray {
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); logger.error("Error removing menu entry: {}", menuText);
} }
if (!hasValue.get()) { if (!hasValue.get()) {