Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7045655

An empty InMemoryCookieStore should not return true for removeAll

XMLWordPrintable

    • b32
    • x86
    • linux
    • Verified

      Spec for java.net.CookieStore says:

      ---------------------------------------------------------------
      boolean removeAll()

          Remove all cookies in this cookie store.

          Returns:
              true if this store changed as a result of the call
      ---------------------------------------------------------------

      However default implementation of this class (sun/net/www/protocol/http/InMemoryCookieStore.java) do not take if store is changed or not:


          public boolean removeAll() {
              lock.lock();
              try {
                  cookieJar.clear();
                  domainIndex.clear();
                  uriIndex.clear();
              } finally {
                  lock.unlock();
              }

              return true;
          }

      So implementation is in conflict with specification
      Specifically, and empty cookie store should not return true for removeAll, since there is no change as a result of the call.

            khazra Kurchi Subhra Hazra
            sreznick Sergey Reznick (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: