-
Sub-task
-
Resolution: Delivered
-
P4
-
18
-
Verified
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.
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.