X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FFileParse.java;fp=src%2Fjalview%2Fio%2FFileParse.java;h=f1d79fe62375b4c2950b6e8e093cfc673e1bb515;hb=08ea977287323e63781dddf6f461c0011833bcc2;hp=128672a2fd6905cafb6652110e45f6552eee80cc;hpb=0a2ad6130c075b62eab8594d29a86eddd9f765a8;p=jalview.git diff --git a/src/jalview/io/FileParse.java b/src/jalview/io/FileParse.java index 128672a..f1d79fe 100755 --- a/src/jalview/io/FileParse.java +++ b/src/jalview/io/FileParse.java @@ -285,19 +285,35 @@ public class FileParse { errormessage = "URL NOT FOUND"; URL url = new URL(urlStr); - HttpURLConnection conn = (HttpURLConnection) url.openConnection(); - int rc = conn.getResponseCode(); - if (rc != HttpURLConnection.HTTP_OK) + URLConnection _conn = url.openConnection(); + if (_conn instanceof HttpURLConnection) { - throw new IOException( - "Response status from " + urlStr + " was " + rc); + HttpURLConnection conn = (HttpURLConnection) _conn; + int rc = conn.getResponseCode(); + if (rc != HttpURLConnection.HTTP_OK) + { + throw new IOException( + "Response status from " + urlStr + " was " + rc); + } + } else { + try { + dataIn = checkForGzipStream(_conn.getInputStream()); + dataName=urlStr; + } catch (IOException ex) + { + throw new IOException("Failed to handle non-HTTP URI stream",ex); + } catch (Exception ex) + { + throw new IOException("Failed to determine type of input stream for given URI",ex); + } + return; } - String encoding = conn.getContentEncoding(); - String contentType = conn.getContentType(); + String encoding = _conn.getContentEncoding(); + String contentType = _conn.getContentType(); boolean isgzipped = "application/x-gzip".equalsIgnoreCase(contentType) || "gzip".equals(encoding); Exception e = null; - InputStream inputStream = conn.getInputStream(); + InputStream inputStream = _conn.getInputStream(); if (isgzipped) { try