Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

Commit 99e03d9

Browse files
committed
Fix getting CookieManager instance outside try catch (Fix #152)
1 parent 5c37ee1 commit 99e03d9

File tree

1 file changed

+1
-1
lines changed
  • app/src/main/java/com/fox2code/mmm/utils

1 file changed

+1
-1
lines changed

app/src/main/java/com/fox2code/mmm/utils/Http.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ public class Http {
7676
}
7777
throw error;
7878
}
79-
CookieManager.getInstance().setAcceptCookie(true);
8079
OkHttpClient.Builder httpclientBuilder = new OkHttpClient.Builder();
8180
// Default is 10, extend it a bit for slow mobile connections.
8281
httpclientBuilder.connectTimeout(15, TimeUnit.SECONDS);
@@ -144,6 +143,7 @@ public class Http {
144143
CookieManager cookieManager;
145144
try {
146145
cookieManager = CookieManager.getInstance();
146+
cookieManager.setAcceptCookie(true);
147147
cookieManager.flush(); // Make sure the instance work
148148
} catch (Throwable t) {
149149
cookieManager = null;

0 commit comments

Comments
 (0)