Merge branch 'update/JAL-3949_jalview_bin_Console_to_cure_sanity_even_more' into...
authorJim Procter <j.procter@dundee.ac.uk>
Sat, 12 Feb 2022 11:49:56 +0000 (11:49 +0000)
committerJim Procter <j.procter@dundee.ac.uk>
Sat, 12 Feb 2022 11:49:56 +0000 (11:49 +0000)
 Conflicts:
test/jalview/bin/CommandLineOperations.java

getdown/lib/getdown-core.jar
getdown/lib/getdown-launcher-local.jar
getdown/lib/getdown-launcher.jar
getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Application.java
j11lib/getdown-core.jar
j8lib/getdown-core.jar
src/jalview/gui/StructureViewerBase.java
test/jalview/bin/CommandLineOperations.java

index 4edf9b0..a11a269 100644 (file)
Binary files a/getdown/lib/getdown-core.jar and b/getdown/lib/getdown-core.jar differ
index 500b38b..4ac9d5d 100644 (file)
Binary files a/getdown/lib/getdown-launcher-local.jar and b/getdown/lib/getdown-launcher-local.jar differ
index 2ead1c7..999c3fa 100644 (file)
Binary files a/getdown/lib/getdown-launcher.jar and b/getdown/lib/getdown-launcher.jar differ
index 684844a..9deb5bc 100644 (file)
@@ -1264,7 +1264,9 @@ public class Application
         String[] sargs = args.toArray(new String[args.size()]);
         log.info("Running " + StringUtil.join(sargs, "\n  "));
 
-        return Runtime.getRuntime().exec(sargs, envp, getAppDir());
+        // don't set the working dir, leave it the same as the working dir of the invocation
+        //return Runtime.getRuntime().exec(sargs, envp, getAppDir());
+        return Runtime.getRuntime().exec(sargs, envp);
     }
 
     /**
index 4edf9b0..a11a269 100644 (file)
Binary files a/j11lib/getdown-core.jar and b/j11lib/getdown-core.jar differ
index 4edf9b0..a11a269 100644 (file)
Binary files a/j8lib/getdown-core.jar and b/j8lib/getdown-core.jar differ
index 8290dd9..349871d 100644 (file)
@@ -1161,7 +1161,7 @@ public abstract class StructureViewerBase extends GStructureViewer
       } else {
           if (processingEntry.hasRetrievalUrl())
           {
-            String safePDBId = java.net.URLEncoder.encode(pdbid,"UTF-8");
+            String safePDBId = java.net.URLEncoder.encode(pdbid,"UTF-8").replace("%","__");
                      
             // retrieve from URL to new local tmpfile
             File tmpFile = File.createTempFile(safePDBId,
index 6bf1505..ee03e77 100644 (file)
@@ -54,7 +54,7 @@ public class CommandLineOperations
     JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
   }
 
-  private static final int TEST_TIMEOUT = 10500; // Note longer timeout needed
+  private static final int TEST_TIMEOUT = 12500; // Note longer timeout needed
                                                 // on
                                                 // full test run than on
                                                 // individual tests
@@ -246,18 +246,53 @@ public class CommandLineOperations
   public void setUpForCommandLineInputOperations() throws IOException
   {
     String cmds = "-open examples/uniref50.fa -noquestionnaire -nousagestats";
-    Worker worker = getJalviewDesktopRunner(false, cmds, SETUP_TIMEOUT);
-    String ln = null;
-    int count = 0;
-    while ((ln = worker.getErrorReader().readLine()) != null)
+    final Worker worker = getJalviewDesktopRunner(false, cmds,
+            SETUP_TIMEOUT);
+    
+    
+    // number of lines expected on STDERR when Jalview starts up normally
+    // may need to adjust this if Jalview is excessively noisy ?
+    final int STDERR_SETUPLINES=30;
+    
+    // thread monitors stderr - bails after SETUP_TIMEOUT or when
+    // STDERR_SETUPLINES have been read
+    Thread runner = new Thread(new Runnable()
     {
-      System.out.println(ln);
-      successfulCMDs.add(ln);
-      if (++count > 30)
+      public void run()
+      {
+        String ln = null;
+        int count = 0;
+        try
+        {
+          while ((ln = worker.getErrorReader().readLine()) != null)
+          {
+            System.out.println(ln);
+            successfulCMDs.add(ln);
+            if (++count > STDERR_SETUPLINES)
+            {
+              break;
+            }
+          }
+        } catch (Exception e)
+        {
+          System.err.println(
+                  "Unexpected Exception reading stderr from the Jalview process");
+          e.printStackTrace();
+        }
+      }
+    });
+    long t = System.currentTimeMillis() + SETUP_TIMEOUT;
+    runner.start();
+    while (!runner.isInterrupted() && System.currentTimeMillis() < t)
+    {
+      try
+      {
+        Thread.sleep(500);
+      } catch (InterruptedException e)
       {
-        break;
       }
     }
+    runner.interrupt();
     if (worker != null && worker.exit == null)
     {
       worker.interrupt();