Corrected handling of cookie attributes with null value

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1644165 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2014-12-09 20:20:06 +00:00
parent dd354a8ba5
commit 4e4424a584
2 changed files with 10 additions and 3 deletions

View File

@ -315,7 +315,14 @@ public String getAttribute(final String name) {
@Override
public boolean containsAttribute(final String name) {
return this.attribs.get(name) != null;
return this.attribs.containsKey(name);
}
/**
* @since 4.4
*/
public boolean removeAttribute(final String name) {
return this.attribs.remove(name) != null;
}
@Override

View File

@ -399,8 +399,8 @@ public void testCookieNullDomainNullPathFormatting() {
Assert.assertEquals(1, headers.size());
Assert.assertEquals("$Version=0; name=; $Path=/", headers.get(0).getValue());
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, null);
cookie.setAttribute(ClientCookie.PATH_ATTR, null);
cookie.removeAttribute(ClientCookie.DOMAIN_ATTR);
cookie.removeAttribute(ClientCookie.PATH_ATTR);
cookies = new ArrayList<Cookie>();
cookies.add(cookie);
headers = cookiespec.formatCookies(cookies);