RFR: JDK-8212035 : merge jdk.test.lib.util.SimpleHttpServer with jaxp.library.SimpleHttpServer [v2]

Daniel Fuchs dfuchs at openjdk.java.net
Fri Dec 11 16:43:00 UTC 2020


On Tue, 8 Dec 2020 16:51:02 GMT, Mahendra Chhipa <github.com+34924738+mahendrachhipa at openjdk.org> wrote:

>> jaxp.library.SimpleHttpServer
>> https://bugs.openjdk.java.net/browse/JDK-8212035
>
> Mahendra Chhipa has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Implemented the review comments.

Changes requested by dfuchs (Reviewer).

test/lib/jdk/test/lib/net/SimpleHttpServer.java line 63:

> 61:         httpServer = HttpServer.create();
> 62:         //let the server use wild card address
> 63:         inetAddress = null;

can this constructor simply call `this(null, context, docRoot)`

test/lib/jdk/test/lib/net/SimpleHttpServer.java line 83:

> 81:         //let the server use wild card address
> 82:         inetAddress = null;
> 83:     }

Ideally, all constructors should all delegate to a single constructor that would do all the assignments. Maybe investigate a constructor that takes an InetSocketAddress (that would contain both InetAddress and port)

test/lib/jdk/test/lib/net/SimpleHttpServer.java line 94:

> 92:         httpServer.setExecutor(executor);
> 93:         httpServer.start();
> 94:         address = "http://localhost:" + httpServer.getAddress().getPort();

It might be a better idea to use the URIBuilder here rather than relying on the local machine configuration to resolve "localhost";

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

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


More information about the net-dev mailing list