当我尝试在 cookiemanager 上设置 cookie 时,我的应用程序静默崩溃(没有强制关闭弹出窗口)。
mHttpClient.getParams().setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, false);
HttpGet http_get = new HttpGet(url);
HttpResponse response = mHttpClient.execute(http_get);
for(Cookie cookie : mHttpClient.getCookieStore().getCookies()) {
Log.d(AppPreferences.TESTTAG,"cookie = " + cookie.getName());
if(cookie.getName().equals("SACSID") || cookie.getName().equals("ACSID"))
{
response.getEntity().consumeContent();
String cookieString = cookie.getName() + "=" + cookie.getValue() + "; domain=" + cookie.getDomain();
CookieManager.getInstance().setCookie(cookie.getDomain(), cookieString); //**crashes here**
return true;
}
}
这是我从 logcat 得到的所有信息
04-19 22:51:35.277: W/dalvikvm(16704): Invalid indirect reference 0x414bb040 in decodeIndirectRef
04-19 22:51:35.277: E/dalvikvm(16704): VM aborting
04-19 22:51:35.281: A/libc(16704): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 16754 (AsyncTask #1)
这是生成的墓碑日志:http ://textuploader.com/?p=6&id=gPpJ
它在 CookieManager setCookie() 行上失败(即我在该行之前和之后记录一条消息,它打印之前的消息但不是之后的消息)
有人遇到这个问题吗?