Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8268960 com/sun/net/httpserver/Headers.java: Ensure mutators normalize keys and disallow null for keys and values
  3. JDK-8269744

Release Note: Prohibit Null for Header Keys and Values in com.sun.net.httpserver.Headers

    XMLWordPrintable

    Details

      Description

      In JDK 18, the handling of header names and values in `jdk.httpserver/com.sun.net.httpserver.Headers` has been reconciled. This includes the eager and consistent prohibition of `null` for names and values.
      The class represents header names and values as a key-value mapping of `Map<String, List <String>>`. Previously, it was possible to create a headers instance with a `null` key or value, which would cause undocumented exceptions when passed to the `HttpServer`. It was also possible to query the instance for a `null` key and `false` would be returned. With this change, all methods of the class now throw a `NullPointerException` if the key or value arguments are `null`. For more information, see https://bugs.openjdk.java.net/browse/JDK-8269296.

        Attachments

          Activity

            People

            Assignee:
            jboes Julia Boes
            Reporter:
            jboes Julia Boes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: