Skip to content

Commit 058c064

Browse files
committed
Produce readable error message when cert failure happens.
1 parent 2aac999 commit 058c064

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

comicViewer/src/main/java/net/bytten/comicviewer/Utility.java

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ private static URLConnection openRedirectableConnection(URL url, int redirects)
2929
if (conn instanceof HttpURLConnection) {
3030
HttpURLConnection http = (HttpURLConnection)conn;
3131
int status = http.getResponseCode();
32+
if (status == -1) {
33+
throw new IOException("A certificate failure occurred. Make sure your device is fully up to date."); // In practice, that seems to be when this HTTP failure occurs
34+
}
3235
if (status == HttpURLConnection.HTTP_MOVED_TEMP || status == HttpURLConnection.HTTP_MOVED_PERM || status == HttpURLConnection.HTTP_SEE_OTHER) {
3336
if (redirects > 2)
3437
throw new IOException("Too many HTTP redirects");

xkcdViewer/build.gradle

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 12
4+
compileSdkVersion 10
55
buildToolsVersion "25.0.2"
66

77
defaultConfig {
@@ -16,6 +16,9 @@ android {
1616
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
1717
}
1818
}
19+
compileOptions {
20+
targetCompatibility JavaVersion.VERSION_1_6
21+
}
1922
}
2023

2124
dependencies {

0 commit comments

Comments
 (0)