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

Julia Boes jboes at openjdk.java.net
Mon Jun 21 14:07:00 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.
> 
> Additionally,  the Headers class is updated to disallow null values for keys and values.

Julia Boes has updated the pull request incrementally with two additional commits since the last revision:

 - disallow null for keys and values
 - disallow null for keys and values

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/4528/files
  - new: https://git.openjdk.java.net/jdk/pull/4528/files/ee9cb576..6301bc1f

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=4528&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=4528&range=00-01

  Stats: 249 lines in 2 files changed: 185 ins; 20 del; 44 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