Code Review Request: 7045655: An empty InMemoryCookieStore should not return true for removeAll

Chris Hegarty chris.hegarty at oracle.com
Thu Mar 15 02:49:32 PDT 2012


Thanks Kurchi, the change look good to me.

This is a corner case and already covered by JCK, but it may be useful 
to amend an existing test to check for this. Maybe 
test/java/net/CookieHandler/NullUriCookieTest.java

         CookieStore cookieStore = (new CookieManager()).getCookieStore();
+        if (cookieStore.removeAll())
+            fail = true;
+        checkFail("removeAll on an empty store should return false");
+

-Chris.

On 14/03/12 22:36, Kurchi Hazra wrote:
> The CookieStore.removeAll() is supposed to return true according to its
> spec, only if the CookieStore changes as a
> result of the call.
>
> InMemoryCookieStore:removeAll() was returning true by default, even if
> the CookieStore object was already empty,
> and no changes were being done by the call. This fix is to simply return
> false in case the CookieStore is empty.
>
> Bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7045655
> Webrev: http://cr.openjdk.java.net/~khazra/7045655/webrev.01/
>
>
> Thanks,
> Kurchi
>



More information about the net-dev mailing list