Merge branch 'develop' into improvement/JAL-3783_upgrade_to_groovy-4
[jalview.git] / src / jalview / gui / Console.java
index bf3942a..b8aad21 100644 (file)
@@ -217,30 +217,14 @@ public class Console extends WindowAdapter
     // logLevelCombo.addItem(LogLevel.ERROR);
     // logLevelCombo.addItem(LogLevel.OFF);
     // set startingLogLevel
-    if (jalview.bin.Console.log == null)
+    
+    if (jalview.bin.Console.getLogger() == null)
     {
-      try
-      {
-        startingLogLevel = LogLevel
-                .valueOf(Cache.getDefault(Cache.JALVIEWLOGLEVEL, null));
-      } catch (IllegalArgumentException e1)
-      {
-        jalview.bin.Console.debug(
-                "Invalid value for preference " + Cache.JALVIEWLOGLEVEL);
-      } catch (NullPointerException e2)
-      {
-        // no value in preferences
-      } finally
-      {
-        if (startingLogLevel == null)
-        {
-          startingLogLevel = LogLevel.INFO;
-        }
-      }
+      startingLogLevel = jalview.bin.Console.getCachedLogLevel();
     }
     else
     {
-      startingLogLevel = jalview.bin.Console.log.getLevel();
+      startingLogLevel = jalview.bin.Console.getLogger().getLevel();
     }
     setChosenLogLevelCombo();
     logLevelCombo.addActionListener(new ActionListener()
@@ -637,7 +621,7 @@ public class Console extends WindowAdapter
         {
           try
           {
-            this.wait(100);
+            this.wait(100); // ##### implicated BLOCKED
             if (pin.available() == 0)
             {
               trimBuffer(false);
@@ -670,7 +654,7 @@ public class Console extends WindowAdapter
         {
           try
           {
-            this.wait(100);
+            this.wait(100); // ##### implicated BLOCKED
             if (pin2.available() == 0)
             {
               trimBuffer(false);
@@ -713,12 +697,16 @@ public class Console extends WindowAdapter
               displayPipe = tmp;
             }
             // simply append whole buffer
-            textArea.append(replace.toString());
-            count += replace.length();
-            if (count > byteslim)
+            synchronized (textArea.getDocument())
             {
-              trimBuffer(false);
+              textArea.append(replace.toString()); // ##### implicated BLOCKED
+              count += replace.length();
+              if (count > byteslim)
+              {
+                trimBuffer(false);
+              }
             }
+
           }
           if (displayPipe.length() == 0)
           {