From a034d9f3e1914fa984f33cc0b3c65e7ca95f3c00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Tue, 4 Oct 2022 16:25:21 +0200 Subject: [PATCH 1/2] Fix ConfigDescriptionsManager misinterpreting a double-quote alone (`"`) as a quoted part --- .../vertx/http/runtime/devmode/ConfigDescriptionsManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescriptionsManager.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescriptionsManager.java index 697bdf4274f3e..98becec8c3602 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescriptionsManager.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescriptionsManager.java @@ -297,7 +297,7 @@ private String ensureQuoted(String part) { } private boolean isQuoted(String part) { - return part.charAt(0) == '\"' && part.charAt(part.length() - 1) == '\"'; + return part.length() >= 2 && part.charAt(0) == '\"' && part.charAt(part.length() - 1) == '\"'; } @Override From a301634907907d91a4e48b4074d0b85cfb4475fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Tue, 4 Oct 2022 16:21:47 +0200 Subject: [PATCH 2/2] Test properties containing a double-quote alone with q/dev/io.quarkus.quarkus-vertx-http/config In particular the environment variable `__INTELLIJ_COMMAND_HISTFILE__`, translated to `%.intellij.command.histfile.`, seems to be giving that page a hard time. --- ...figMisinterpretedDoubleUnderscoreTest.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleConfigMisinterpretedDoubleUnderscoreTest.java diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleConfigMisinterpretedDoubleUnderscoreTest.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleConfigMisinterpretedDoubleUnderscoreTest.java new file mode 100644 index 0000000000000..519d8d758578a --- /dev/null +++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleConfigMisinterpretedDoubleUnderscoreTest.java @@ -0,0 +1,32 @@ +package io.quarkus.vertx.http.devconsole; + +import org.hamcrest.Matchers; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import io.quarkus.test.QuarkusDevModeTest; +import io.restassured.RestAssured; + +/** + * Tests that a system property such as {@code %.intellij.command.histfile."} + * doesn't lead to an exception because {@code "} is incorrectly seen as a quoted property. + *

+ * Originally the bug stemmed from an environment property {@code __INTELLIJ_COMMAND_HISTFILE__} + * which was (weirdly) interpreted as {@code %.intellij.command.histfile."}, + * but it's much easier to test system properties (which are mutable) + * than environment properties. + */ +public class DevConsoleConfigMisinterpretedDoubleUnderscoreTest { + + @RegisterExtension + static final QuarkusDevModeTest config = new QuarkusDevModeTest() + .setBuildSystemProperty("%.intellij.command.histfile.\"", "foo") + .withEmptyApplication(); + + @Test + public void testNoFailure() { + RestAssured.get("q/dev/io.quarkus.quarkus-vertx-http/config") + .then() + .statusCode(200).body(Matchers.containsString("Config Editor")); + } +}