Skip to content

Commit

Permalink
Update JdkHttpServerFactory.java (#5163)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthiasvanderhallen authored Sep 22, 2022
1 parent 47dccff commit f2f95f9
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -223,11 +223,15 @@ private static HttpServer createHttpServer(final URI uri,
? (isHttp ? Container.DEFAULT_HTTP_PORT : Container.DEFAULT_HTTPS_PORT)
: uri.getPort();

final InetSocketAddress socketAddress = (uri.getHost() == null)
? new InetSocketAddress(port)
: new InetSocketAddress(uri.getHost(), port);

final HttpServer server;
try {
server = isHttp
? HttpServer.create(new InetSocketAddress(port), 0)
: HttpsServer.create(new InetSocketAddress(port), 0);
? HttpServer.create(socketAddress, 0)
: HttpsServer.create(socketAddress, 0);
} catch (final IOException ioe) {
throw new ProcessingException(LocalizationMessages.ERROR_CONTAINER_EXCEPTION_IO(), ioe);
}
Expand Down

0 comments on commit f2f95f9

Please sign in to comment.