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 12:59:52 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.

test/lib/jdk/test/lib/net/HttpHeaderParser.java line 45:

> 43:         String headerString = "";
> 44:             BufferedReader br = new BufferedReader(new InputStreamReader(this.is));
> 45:             //First line is either request line or status line

Alignment issue? Could you fix the formatting?

test/lib/jdk/test/lib/net/HttpHeaderParser.java line 46:

> 44:             BufferedReader br = new BufferedReader(new InputStreamReader(this.is));
> 45:             //First line is either request line or status line
> 46:             requestOrStatusLine = br.readLine().strip();

Stripping the line could hide errors, as a status/request line is not supposed to start with a whitespace, for instance

test/lib/jdk/test/lib/net/HttpHeaderParser.java line 62:

> 60:                     }
> 61:                     if(!headerMap.containsKey(key.strip())) {
> 62:                         headerMap.put(key.strip(), values);

It may not be a good idea to remove whitespace in a header key as it should not contain any whitespace. Doing so could hide protocol errors.

test/lib/jdk/test/lib/net/HttpHeaderParser.java line 69:

> 67:                 }
> 68:             }
> 69:     }

Still missing code to handle continuation lines.

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

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


More information about the net-dev mailing list