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

PAYARA-2555 Micro Arquillian Container Doesn't Allow Spaces In Arguments #2481

Merged
merged 6 commits into from
Feb 28, 2018
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,14 @@ public void validate() throws ConfigurationException {
"Unable to find Payara Micro Jar version. Please check the file is a valid Payara Micro Jar.", e);
}
notNull(getMicroVersion(), "Unable to find Payara Micro Jar version. Please check the file is a valid Payara Micro Jar.");

// Escape spaces in paths for the cmd options
if (cmdOptions != null) {
cmdOptions = cmdOptions.replaceAll("([\\/\\\\]\\w+) ", "$1\\\\ ");
}
if (extraMicroOptions != null) {
extraMicroOptions = extraMicroOptions.replaceAll("([\\/\\\\]\\w+) ", "$1\\\\ ");
}
}

private static String getConfigurableVariable(String systemPropertyName, String environmentVariableName, String defaultValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,20 @@ public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
// Add the extra cmd options to the Payara Micro instance
if (configuration.getCmdOptions() != null) {
int index = 1;
for (String option : configuration.getCmdOptions().split(" ")) {
cmd.add(index, option);
// Split on non-escaped spaces
for (String option : configuration.getCmdOptions().split("(?<!\\\\) ")) {
// Unescape any path spaces before adding the string
cmd.add(index, option.replace("\\ ", " "));
index++;
}
}

// Add the extra micro options to the Payara Micro instance
if (configuration.getExtraMicroOptions() != null) {
for (String option : configuration.getExtraMicroOptions().split(" ")) {
cmd.add(option);
// Split on non-escaped spaces
for (String option : configuration.getExtraMicroOptions().split("(?<!\\\\) ")) {
// Unescape any path spaces before adding the string
cmd.add(option.replace("\\ ", " "));
}
}

Expand Down