CookieManager.get() doesn't work if uri.getPath() == ""

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P2
    • 7
    • Affects Version/s: 6u3
    • Component/s: core-libs
    • None
    • generic
    • solaris_nevada

      If CookieManager.get() is called with an URI that does not contain a path, e.g "http://www.sun.com" instead of "http://www.sun.com/", it does not return any cookies, even if CookieManager contains cookies for the URI.

      The relevant code is:

          /*
           * path-matches algorithm, as defined by RFC 2965
           */
          private boolean pathMatches(String path, String pathToMatchWith) {
              if (path == pathToMatchWith)
                  return true;
              if (path == null || pathToMatchWith == null)
                  return false;
              if (path.startsWith(pathToMatchWith))
                  return true;

              return false;
          }

      That needs to cater for the case where path is the empty string.

            Assignee:
            Jean-Christophe Collet (Inactive)
            Reporter:
            Alan Burlison
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: