From 21adee6e84dafaf67baed8d28bfacea8aa8ff7ec Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Mon, 11 Mar 2024 10:48:33 +0200 Subject: [PATCH] Fail to deploy application when http and https ports are the same Vert.x seems not thrown any exception in this scenario, but it then throws NPEs in either the secure or insecure handling of requests. This behavior is very odd and provides users no good ways of diagnosing the problem Closes: #39289 --- .../io/quarkus/vertx/http/runtime/VertxHttpRecorder.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java index a0f973be8b94b..b2ea34acc7f61 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java @@ -1187,8 +1187,10 @@ public void handle(AsyncResult event) { if (https) { actualHttpsPort = actualPort; + validateHttpPorts(actualHttpPort, actualHttpsPort); } else { actualHttpPort = actualPort; + validateHttpPorts(actualHttpPort, actualHttpsPort); } if (actualPort != options.getPort()) { // Override quarkus.http(s)?.(test-)?port @@ -1220,6 +1222,12 @@ public void handle(AsyncResult event) { } } + + private void validateHttpPorts(int httpPort, int httpsPort) { + if (httpsPort == httpPort) { + throw new IllegalArgumentException("Both http and https servers started on port " + httpPort); + } + } }); }