Merge branch 'develop' into merge/JAL-4262+JAL-4265+JAL-4269+JAL-4274+JAL-4277+JAL...
[jalview.git] / src / jalview / bin / Commands.java
index 65030a4..faa5e43 100644 (file)
@@ -149,10 +149,14 @@ public class Commands
 
     }
 
-    // report errors
-    Console.warn(
-            "The following errors and warnings occurred whilst processing files:\n"
-                    + errorsToString());
+    // report errors - if any
+    String errorsRaised = errorsToString();
+    if (errorsRaised.trim().length() > 0)
+    {
+      Console.warn(
+              "The following errors and warnings occurred whilst processing files:\n"
+                      + errorsRaised);
+    }
     // gui errors reported in Jalview
 
     if (argParser.getBoolean(Arg.QUIT))
@@ -782,7 +786,11 @@ public class Commands
                   // RESTORE SESSION AFTER EXPORT IF NEED BE
                   if (sessionToRestore != null)
                   {
-                    sview.getBinding().openSession(sessionToRestore.getCanonicalPath());
+                    Console.debug("Restoring session from "
+                            + sessionToRestore);
+                    
+                    sview.getBinding().restoreSession(sessionToRestore.getAbsolutePath());
+
                   }
                 } catch (ImageOutputException ioexc)
                 {
@@ -791,15 +799,14 @@ public class Commands
                   isError = true;
                   continue;
                 }
-                catch (IOException ioexec)
-                {
-                  addError("Unexpected error when restoring structure viewer session after custom view operations.");
-                  isError = true;
-                  continue;
-                }
                 finally
                 {
-                  this.colourAlignFrame(af, originalColourScheme);
+                  try {
+                    this.colourAlignFrame(af, originalColourScheme);
+                  } catch (Exception t)
+                  {
+                    addError("Unexpected error when restoring colourscheme to alignment after temporary change for export.",t);
+                  }
                 }
               }
             }