android - XWalk (Crosswalk) CookieManager crashes app in NDK -
i'm doing following:
in
launcher
activity, afteroncreate
i'm initializing defaultcookiemanager
so:cookiemanager cookiemanager = cookiemanager.getinstance(); if (build.version.sdk_int < build.version_codes.lollipop) { cookiesyncmanager.createinstance(ctx); } cookiemanager.setacceptcookie(true); cookiemanager.setacceptfileschemecookies(true);
after i'm doing this...
cookiehandler.setdefault(new webkitcookiemanagerproxy());
...where i'm extending
cookiemanager
, doing this:public class webkitcookiemanagerproxy extends cookiemanager { private static final string tag = webkitcookiemanagerproxy.class.getname(); private xwalkcookiemanager crosswalkcookiemanager; public webkitcookiemanagerproxy() { this(null, null); } /* package */ webkitcookiemanagerproxy(cookiestore store, cookiepolicy cookiepolicy) { super(null, cookiepolicy); this.crosswalkcookiemanager = new xwalkcookiemanager(); } // java.net.cookiemanager overrides @override public void put(uri uri, map<string, list<string>> responseheaders) throws ioexception { // make sure our args valid if ((uri == null) || (responseheaders == null)) return; // save our url once string url = uri.tostring(); // go on headers (string headerkey : responseheaders.keyset()) { // ignore headers aren't cookie related if ((headerkey == null) || !(headerkey.equalsignorecase("set-cookie2") || headerkey.equalsignorecase("set-cookie"))) continue; // process each of headers (string headervalue : responseheaders.get(headerkey)) { this.crosswalkcookiemanager.setcookie(url, headervalue); } } } @override public map<string, list<string>> get(uri uri, map<string, list<string>> requestheaders) throws ioexception { // make sure our args valid if ((uri == null) || (requestheaders == null)) throw new illegalargumentexception("argument null"); // save our url once string url = uri.tostring(); // prepare our response map<string, list<string>> res = new java.util.hashmap<string, list<string>>(); // cookie string cookie = null; if (this.crosswalkcookiemanager.hascookies()) { cookie = this.crosswalkcookiemanager.getcookie(url); } // return if (cookie != null) { res.put("cookie", arrays.aslist(cookie)); } return res; } @override public cookiestore getcookiestore() { // don't want work cookie store directly throw new unsupportedoperationexception(); }
}
my problem when enters put()
method above, crashes exception. calls on manager crashes app, example calling hascookies()
or getcookies()
Comments
Post a Comment