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

HttpCookie.domainMatches("hostname.local", "hostname") should return true

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • P4
    • Resolution: Fixed
    • 7
    • 8
    • core-libs
    • None
    • b04
    • generic
    • generic
    • Verified

    Description

      I find that HttpCookie.domainMatches("hostname.local", "hostname") returns false, which may be a bug. According to spec, the effective host name of "hostname" is "hostname.local", which is string exactly the same with the first parameter. Thus the method should return true for this invocation.

      Simple testcase:

      // Testcase
      import java.net.HttpCookie;

      public class DomainMatchTest{

         public static void main(String args[]){
            // "true" should be printed, but get "false".
            System.out.println(HttpCookie.domainMatches("hostname.local", "hostname"));
         }

      }
      // End of testcase

      see discussion on net-dev mailing list:
        http://mail.openjdk.java.net/pipermail/net-dev/2011-March/002788.html

      Attachments

        Activity

          People

            chegar Chris Hegarty
            chegar Chris Hegarty
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: