From b0c8c09029acab188f2b077159b328b38e0a1723 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..d8d4a28e3ba10 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 static void validateHttpPorts(int httpPort, int httpsPort) { + if (httpsPort == httpPort) { + throw new IllegalArgumentException("Both http and https servers started on port " + httpPort); + } + } }); }