Sunday, March 31, 2019

android - java.io.IOException: Received authentication challenge is null

I need get a response code, but it's throw a IOException. I don't know what's the matter!




    try
{
url = new URL(urlBuilder.toString());
conn = (HttpURLConnection) url.openConnection();
conn.setDoInput(true);
conn.setConnectTimeout(TIME_OUT);
conn.setRequestMethod(METHOD_GET);
conn.setRequestProperty("accept", "*/*");
conn.connect();
int responseCode = conn.getResponseCode(); //throw IOException:Received authentication challenge is null

if (responseCode == HTTP_OK)
{
inStream = conn.getInputStream();
response = getResponse(inStream);
}
else
{
response = "response code:"+responseCode;
}
} catch (Exception e)

{
throw e;
}
finally
{
conn.disconnect();
}
return response;
}



the IOException is :



05-03 20:14:01.577: WARN/System.err(1515): java.io.IOException: Received authentication challenge is null
05-03 20:14:01.596: WARN/System.err(1515): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.doRequestInternal(HttpURLConnectionImpl.java:1694)
05-03 20:14:01.577: INFO/QQWeiBo(1515): Received authentication challenge is null
05-03 20:14:01.577: WARN/System.err(1515): java.io.IOException: Received authentication challenge is null
05-03 20:14:01.577: WARN/System.err(1515): java.io.IOException: Received authentication challenge is null
05-03 20:14:01.596: WARN/System.err(1515): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.doRequestInternal(HttpURLConnectionImpl.java:1694)
05-03 20:14:01.596: WARN/System.err(1515): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.doRequest(HttpURLConnectionImpl.java:1649)

05-03 20:14:01.596: WARN/System.err(1515): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:1374)
05-03 20:14:01.596: WARN/System.err(1515): at com.szy.weibo.service.SyncHttp.httpGet(SyncHttp.java:72)
05-03 20:14:01.596: WARN/System.err(1515): at com.szy.weibo.service.Weibo.getRequestToken(Weibo.java:45)
05-03 20:14:01.606: WARN/System.err(1515): at com.szy.weibo.MainActivity.startWebView(MainActivity.java:95)
05-03 20:14:01.606: WARN/System.err(1515): at com.szy.weibo.MainActivity.authorization(MainActivity.java:83)
05-03 20:14:01.606: WARN/System.err(1515): at com.szy.weibo.MainActivity$1.onClick(MainActivity.java:71)
05-03 20:14:01.606: WARN/System.err(1515): at android.view.View.performClick(View.java:2408)
05-03 20:14:01.596: WARN/System.err(1515): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.doRequestInternal(HttpURLConnectionImpl.java:1694)
05-03 20:14:01.596: WARN/System.err(1515): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.doRequest(HttpURLConnectionImpl.java:1649)
05-03 20:14:01.596: WARN/System.err(1515): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:1374)

05-03 20:14:01.596: WARN/System.err(1515): at com.szy.weibo.service.SyncHttp.httpGet(SyncHttp.java:72)
05-03 20:14:01.596: WARN/System.err(1515): at com.szy.weibo.service.Weibo.getRequestToken(Weibo.java:45)
05-03 20:14:01.606: WARN/System.err(1515): at com.szy.weibo.MainActivity.startWebView(MainActivity.java:95)
05-03 20:14:01.606: WARN/System.err(1515): at com.szy.weibo.MainActivity.authorization(MainActivity.java:83)
05-03 20:14:01.606: WARN/System.err(1515): at com.szy.weibo.MainActivity$1.onClick(MainActivity.java:71)
05-03 20:14:01.606: WARN/System.err(1515): at android.view.View.performClick(View.java:2408)
05-03 20:14:01.596: WARN/System.err(1515): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.doRequest(HttpURLConnectionImpl.java:1649)
05-03 20:14:01.596: WARN/System.err(1515): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:1374)
05-03 20:14:01.596: WARN/System.err(1515): at com.szy.weibo.service.SyncHttp.httpGet(SyncHttp.java:72)
05-03 20:14:01.596: WARN/System.err(1515): at com.szy.weibo.service.Weibo.getRequestToken(Weibo.java:45)

05-03 20:14:01.606: WARN/System.err(1515): at com.szy.weibo.MainActivity.startWebView(MainActivity.java:95)
05-03 20:14:01.606: WARN/System.err(1515): at com.szy.weibo.MainActivity.authorization(MainActivity.java:83)
05-03 20:14:01.606: WARN/System.err(1515): at com.szy.weibo.MainActivity$1.onClick(MainActivity.java:71)
05-03 20:14:01.606: WARN/System.err(1515): at android.view.View.performClick(View.java:2408)
05-03 20:14:01.606: WARN/System.err(1515): at android.view.View$PerformClick.run(View.java:8816)
05-03 20:14:01.616: WARN/System.err(1515): at android.os.Handler.handleCallback(Handler.java:587)
05-03 20:14:01.627: WARN/System.err(1515): at android.os.Handler.dispatchMessage(Handler.java:92)
05-03 20:14:01.627: WARN/System.err(1515): at android.os.Looper.loop(Looper.java:123)
05-03 20:14:01.627: WARN/System.err(1515): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-03 20:14:01.627: WARN/System.err(1515): at java.lang.reflect.Method.invokeNative(Native Method)

05-03 20:14:01.606: WARN/System.err(1515): at android.view.View$PerformClick.run(View.java:8816)
05-03 20:14:01.616: WARN/System.err(1515): at android.os.Handler.handleCallback(Handler.java:587)
05-03 20:14:01.627: WARN/System.err(1515): at android.os.Handler.dispatchMessage(Handler.java:92)
05-03 20:14:01.627: WARN/System.err(1515): at android.os.Looper.loop(Looper.java:123)
05-03 20:14:01.627: WARN/System.err(1515): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-03 20:14:01.627: WARN/System.err(1515): at java.lang.reflect.Method.invokeNative(Native Method)
05-03 20:14:01.627: WARN/System.err(1515): at java.lang.reflect.Method.invoke(Method.java:521)
05-03 20:14:01.647: WARN/System.err(1515): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-03 20:14:01.647: WARN/System.err(1515): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-03 20:14:01.647: WARN/System.err(1515): at dalvik.system.NativeStart.main(Native Method)

05-03 20:14:01.606: WARN/System.err(1515): at android.view.View$PerformClick.run(View.java:8816)
05-03 20:14:01.616: WARN/System.err(1515): at android.os.Handler.handleCallback(Handler.java:587)
05-03 20:14:01.627: WARN/System.err(1515): at android.os.Handler.dispatchMessage(Handler.java:92)
05-03 20:14:01.627: WARN/System.err(1515): at android.os.Looper.loop(Looper.java:123)
05-03 20:14:01.627: WARN/System.err(1515): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-03 20:14:01.627: WARN/System.err(1515): at java.lang.reflect.Method.invokeNative(Native Method)
05-03 20:14:01.627: WARN/System.err(1515): at java.lang.reflect.Method.invoke(Method.java:521)
05-03 20:14:01.647: WARN/System.err(1515): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-03 20:14:01.647: WARN/System.err(1515): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-03 20:14:01.647: WARN/System.err(1515): at dalvik.system.NativeStart.main(Native Method)

05-03 20:14:01.627: WARN/System.err(1515): at java.lang.reflect.Method.invoke(Method.java:521)
05-03 20:14:01.647: WARN/System.err(1515): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-03 20:14:01.647: WARN/System.err(1515): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-03 20:14:01.647: WARN/System.err(1515): at dalvik.system.NativeStart.main(Native Method)

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...