JAL-4414 Add SocketTimeoutException to exceptions that trigger File Not Found rather...
authorBen Soares <b.soares@dundee.ac.uk>
Wed, 29 May 2024 12:08:09 +0000 (13:08 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Wed, 29 May 2024 12:08:09 +0000 (13:08 +0100)
src/jalview/bin/Commands.java
src/jalview/io/FileParse.java

index 97ab98e..eb81847 100644 (file)
@@ -292,6 +292,8 @@ public class Commands
         {
           addError((protocol == DataSourceType.URL ? "File at URL" : "File")
                   + " '" + openFile + "' not found");
+          isError = true;
+          continue;
         } catch (FileFormatException e1)
         {
           addError("Unknown file format for '" + openFile + "'");
index 57b2ce5..dd85907 100755 (executable)
@@ -34,6 +34,7 @@ import java.io.Reader;
 import java.io.StringReader;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
+import java.net.SocketTimeoutException;
 import java.net.URL;
 import java.net.URLConnection;
 import java.net.UnknownHostException;
@@ -505,7 +506,8 @@ public class FileParse
           if (suffixLess == null)
           {
             if (e instanceof FileNotFoundException
-                    || e instanceof UnknownHostException)
+                    || e instanceof UnknownHostException
+                    || e instanceof SocketTimeoutException)
             {
               errormessage = "File at URL '" + fileStr + "' not found";
               filenotfound = true;
@@ -521,7 +523,9 @@ public class FileParse
             {
               errormessage = "BAD URL WITH OR WITHOUT SUFFIX '" + fileStr
                       + "'";
-              if (e instanceof FileNotFoundException)
+              if (e instanceof FileNotFoundException
+                      || e instanceof UnknownHostException
+                      || e instanceof SocketTimeoutException)
               {
                 filenotfound = true;
               }