From 7bb6882463062279027fa73984328edc864fd047 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Wed, 29 May 2024 13:08:09 +0100 Subject: [PATCH] JAL-4414 Add SocketTimeoutException to exceptions that trigger File Not Found rather than Format Not Recognised --- src/jalview/bin/Commands.java | 2 ++ src/jalview/io/FileParse.java | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/jalview/bin/Commands.java b/src/jalview/bin/Commands.java index 97ab98e..eb81847 100644 --- a/src/jalview/bin/Commands.java +++ b/src/jalview/bin/Commands.java @@ -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 + "'"); diff --git a/src/jalview/io/FileParse.java b/src/jalview/io/FileParse.java index 57b2ce5..dd85907 100755 --- a/src/jalview/io/FileParse.java +++ b/src/jalview/io/FileParse.java @@ -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; } -- 1.7.10.2