RFR: 8268960: com/sun/net/httpserver/Headers.java: Ensure all mutator methods normalize keys

Julia Boes jboes at openjdk.java.net
Fri Jun 18 10:57:44 UTC 2021


`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 improve `equals()` by adding a type check and add a `toString()` implementation.

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

Commit messages:
 - add toString
 - Merge branch master
 - initial commit

Changes: https://git.openjdk.java.net/jdk/pull/4528/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4528&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8268960
  Stats: 119 lines in 2 files changed: 113 ins; 0 del; 6 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4528.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4528/head:pull/4528

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


More information about the net-dev mailing list