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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • 7
    • 6u3
    • 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.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: