提交 bebc45cc 编写于 作者: V valeriep

Merge

...@@ -348,7 +348,13 @@ ifneq ($(PLATFORM), windows) ...@@ -348,7 +348,13 @@ ifneq ($(PLATFORM), windows)
" Try setting LANG to 'C'. \n" \ " Try setting LANG to 'C'. \n" \
"" >> $(WARNING_FILE) ; \ "" >> $(WARNING_FILE) ; \
fi fi
ifeq ($(PLATFORM), macosx)
@if [ "$(LANG)" = "" ]; then \
$(ECHO) "ERROR: LANG must be set on Mac OS X. Recommended value is \"C\"" >> $(ERROR_FILE) ; \
fi
endif endif
endif
###################################################### ######################################################
# Check the Windows cygwin version # Check the Windows cygwin version
......
...@@ -207,6 +207,9 @@ class InMemoryCookieStore implements CookieStore { ...@@ -207,6 +207,9 @@ class InMemoryCookieStore implements CookieStore {
public boolean removeAll() { public boolean removeAll() {
lock.lock(); lock.lock();
try { try {
if (cookieJar.isEmpty()) {
return false;
}
cookieJar.clear(); cookieJar.clear();
domainIndex.clear(); domainIndex.clear();
uriIndex.clear(); uriIndex.clear();
......
...@@ -23,8 +23,9 @@ ...@@ -23,8 +23,9 @@
/* /*
* @test * @test
* @bug 6953455 * @bug 6953455 7045655
* @summary CookieStore.add() cannot handle null URI parameter * @summary CookieStore.add() cannot handle null URI parameter
* and An empty InMemoryCookieStore should not return true for removeAll
*/ */
import java.net.CookieManager; import java.net.CookieManager;
...@@ -44,6 +45,11 @@ public class NullUriCookieTest { ...@@ -44,6 +45,11 @@ public class NullUriCookieTest {
static void checkCookieNullUri() throws Exception { static void checkCookieNullUri() throws Exception {
//get a cookie store implementation and add a cookie to the store with null URI //get a cookie store implementation and add a cookie to the store with null URI
CookieStore cookieStore = (new CookieManager()).getCookieStore(); CookieStore cookieStore = (new CookieManager()).getCookieStore();
//Check if removeAll() retrurns false on an empty CookieStore
if (cookieStore.removeAll()) {
fail = true;
}
checkFail("removeAll on empty store should return false");
HttpCookie cookie = new HttpCookie("MY_COOKIE", "MY_COOKIE_VALUE"); HttpCookie cookie = new HttpCookie("MY_COOKIE", "MY_COOKIE_VALUE");
cookie.setDomain("foo.com"); cookie.setDomain("foo.com");
cookieStore.add(null, cookie); cookieStore.add(null, cookie);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册