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

Check on '$' character is missing in the HttpCookie class constructor

    XMLWordPrintable

Details

    • b94
    • generic
    • generic
    • Verified

    Description

      This testcase passes with JDK8 b48 and fails JDK8 b49

      import java.net.HttpCookie;

      public class Test {

          public static void main(String argv[]) {
              System.out.println(new Test().run());
          }

          public String run() {
              try {
                  new HttpCookie("$Name", "value");
                  return "Failed";
              } catch (IllegalArgumentException e) {
                  return "OKAY";
              }
          }
      }

      Run example:
      jdk1.8.0b48\bin\java.exe Test
      OKAY

      jdk1.8.0b49\bin\java.exe Test
      Failed

      Checking on '$' character was missed during fix CR7183292
      See: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/7bd32bfc0539
      - if (name.length() == 0 || !isToken(name) || isReserved(name)) {
      + if (name.length() == 0 || !isToken(name)) {

      Nevertheless in the JDK7, all is well:
      http://hg.openjdk.java.net/jdk7u/jdk7u6-dev/jdk/rev/cbb4a165d660
      - if (name.length() == 0 || !isToken(name) || isReserved(name)) {
      + if (name.length() == 0 || !isToken(name) || name.charAt(0) == '$') {

      Attachments

        Issue Links

          Activity

            People

              jzavgren John Zavgren (Inactive)
              psemenov Pavel Semenov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: