Fix #1898 Ignore bad cookies in getCookie

This commit is contained in:
Greg Wilkins 2017-10-25 10:56:13 +11:00
parent 4a0569f2dc
commit 8dc3627d42
1 changed files with 17 additions and 10 deletions

View File

@ -122,16 +122,23 @@ public class Cookies extends CookieCutter
@Override @Override
protected void addCookie(String name, String value, String domain, String path, int version, String comment) protected void addCookie(String name, String value, String domain, String path, int version, String comment)
{ {
Cookie cookie = new Cookie(name,value); try
if (domain!=null) {
cookie.setDomain(domain); Cookie cookie = new Cookie(name,value);
if (path!=null) if (domain!=null)
cookie.setPath(path); cookie.setDomain(domain);
if (version>0) if (path!=null)
cookie.setVersion(version); cookie.setPath(path);
if (comment!=null) if (version>0)
cookie.setComment(comment); cookie.setVersion(version);
_cookieList.add(cookie); if (comment!=null)
cookie.setComment(comment);
_cookieList.add(cookie);
}
catch(Exception e)
{
LOG.debug(e);
}
} }
} }