From 90651fafe83a89641fbd5b6d20e10824466b6765 Mon Sep 17 00:00:00 2001 From: Luis Uguina Date: Sat, 23 May 2020 23:10:01 +1000 Subject: [PATCH] Fix: app randomly hung when the upload queue is full (#231) --- src/com/sheepit/client/Log.java | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/com/sheepit/client/Log.java b/src/com/sheepit/client/Log.java index 56ceb0c..2cdf286 100644 --- a/src/com/sheepit/client/Log.java +++ b/src/com/sheepit/client/Log.java @@ -55,15 +55,22 @@ public class Log { } private void append(String level_, String msg_) { - if (msg_.equals("") == false) { - String line = this.dateFormat.format(new java.util.Date()) + " (" + level_ + ") " + msg_; - if (this.checkpoints.containsKey(this.lastCheckPoint) && this.checkpoints.get(this.lastCheckPoint) != null) { - this.checkpoints.get(this.lastCheckPoint).add(line); - } - if (this.printStdOut == true) { - System.out.println(line); + String line = null; + + try { + if (msg_.equals("") == false) { + line = this.dateFormat.format(new java.util.Date()) + " (" + level_ + ") " + msg_; + if (this.checkpoints.containsKey(this.lastCheckPoint) && this.checkpoints.get(this.lastCheckPoint) != null) { + this.checkpoints.get(this.lastCheckPoint).add(line); + } + if (this.printStdOut == true) { + System.out.println(line); + } } } + catch (Exception e) { + // Nothing to do here. Just allow the thread to continue + } } public int newCheckPoint() {