RFR: JDK-8061729 : Update java/net tests to eliminate dependency on sun.net.www.MessageHeader and some other internal APIs [v2]

Daniel Fuchs dfuchs at openjdk.java.net
Fri Oct 15 13:11:48 UTC 2021


On Fri, 15 Oct 2021 12:38:14 GMT, Mahendra Chhipa <duke at openjdk.java.net> wrote:

>> There are some regression tests depending on sun.net.www.MessageHeader, the internal API dependency should be removed. Some of other internal API dependancies are removed in following issues :
>> JDK-8273142
>> JDK-8268464
>> JDK-8268133
>
> Mahendra Chhipa has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Implemented review comments.

It would be good to have a separate test to test the behavior of the new library `HttpHeaderParser` class.
As an example, here [1] is the test we have written for the HttpClient Http1HeaderParser. You will see that it defines a numbers of test cases (response headers) - both positive and negative - and verifies that `sun.net.www.MessageHeader` and `Http1HeaderParser` give the same results in the positive case. It would be good to have something similar for `HttpHeaderParser` as it would give more confidence that the parsing is correct. You would need of course to add in your test new test cases that contain a request line - the Http1HeaderParser only parses status line since it's only used on the client side.

[1] https://github.com/openjdk/jdk/blob/master/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/Http1HeaderParserTest.java

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

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



More information about the security-dev mailing list