Skip to content

Commit 5dae927

Browse files
committed
HTTPSUtil: Use HTTP in case of SocketException
1 parent 70ade27 commit 5dae927

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main/java/net/imagej/updater/util/HTTPSUtil.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.io.IOException;
99
import java.net.HttpURLConnection;
1010
import java.net.ProtocolException;
11+
import java.net.SocketException;
1112
import java.net.SocketTimeoutException;
1213
import java.net.URL;
1314
import java.net.UnknownHostException;
@@ -56,6 +57,12 @@ public static void checkHTTPSSupport(LogService log) {
5657
"Please contact your system administrator to enable communication via HTTPS.";
5758
if (log != null) log.warn(msg);
5859
else System.out.println("[WARNING] " + msg);
60+
} catch (SocketException e) {
61+
secureMode = false;
62+
String msg = "SocketException while trying to update securely via HTTPS. Will fall back to HTTP. This is a security risk. " +
63+
"Try downloading a new version of this software. If you're behind a proxy, call Edit > Options > Proxy Settings.";
64+
if (log != null) log.warn(msg);
65+
else System.out.println("[WARNING] " + msg);
5966
} catch (IOException e) {
6067
e.printStackTrace();
6168
}

0 commit comments

Comments
 (0)