Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ConfigDescriptionsManager misinterpreting a double-quote alone (") as a quoted part #28381

Merged
merged 2 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.
* <p>
* 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"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down