Integrated: 8268960: com/sun/net/httpserver/Headers.java: Ensure mutators normalize keys and disallow null for keys and values

Julia Boes jboes at openjdk.java.net
Thu Jul 1 10:01:06 UTC 2021


On Fri, 18 Jun 2021 10:43:06 GMT, Julia Boes <jboes at openjdk.org> wrote:

> `com.sun.net.httpserver.Headers` normalizes its keys to adhere to the following format: First character uppercase, all other characters lowercase, for example `"foo" -> "Foo"`. This behaviour is not consistent across the mutator methods of the class, in particular `putAll()` and `replaceAll()` do not apply normalization.
> 
> The suggested fix is to update the implementation of `putAll()` and to add an implementation of of the java.util.Map default method `replaceAll()`. While here, we can add a `toString()` implementation to provide a more informative string.
> 
> Additionally,  the Headers class is updated to disallow null values for keys and values.
> 
> Testing: tier 1-3 all clear
> CSR: https://bugs.openjdk.java.net/browse/JDK-8269296

This pull request has now been integrated.

Changeset: 82bfc5d4
Author:    Julia Boes <jboes at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/82bfc5d45c54fb37dc021bc91fa17efe34f77f44
Stats:     345 lines in 2 files changed: 312 ins; 13 del; 20 mod

8268960: com/sun/net/httpserver/Headers.java: Ensure mutators normalize keys and disallow null for keys and values

Reviewed-by: chegar, dfuchs, michaelm

-------------

PR: https://git.openjdk.java.net/jdk/pull/4528


More information about the net-dev mailing list