You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2022/02/21 13:12:05 UTC
[hop] branch master updated: HOP-3778: fix argument passing with spaces
This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/master by this push:
new d951510 HOP-3778: fix argument passing with spaces
new 6c3e6ec Merge pull request #1380 from hansva/master
d951510 is described below
commit d951510c4efda3cde5556029be5654e8539e4e0e
Author: Hans Van Akelyen <ha...@gmail.com>
AuthorDate: Mon Feb 21 13:39:44 2022 +0100
HOP-3778: fix argument passing with spaces
---
assemblies/static/src/main/resources/hop-server.sh | 4 +---
docker/resources/load-and-execute.sh | 2 +-
engine/pom.xml | 2 +-
engine/src/main/java/org/apache/hop/www/HopServer.java | 12 ++++++++----
4 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/assemblies/static/src/main/resources/hop-server.sh b/assemblies/static/src/main/resources/hop-server.sh
index aea22c6..4c5f8c1 100755
--- a/assemblies/static/src/main/resources/hop-server.sh
+++ b/assemblies/static/src/main/resources/hop-server.sh
@@ -86,9 +86,7 @@ if [ ! "x$JAAS_LOGIN_MODULE_CONFIG" = "x" -a ! "x$JAAS_LOGIN_MODULE_NAME" = "x"
HOP_OPTIONS=$HOP_OPTIONS" -Dloginmodulename=$JAAS_LOGIN_MODULE_NAME"
fi
-# OPTIONS="$OPTIONS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
-
-"$_HOP_JAVA" ${HOP_OPTIONS} -Djava.library.path=$LIBPATH -classpath ${CLASSPATH} org.apache.hop.www.HopServer $@
+"$_HOP_JAVA" ${HOP_OPTIONS} -Djava.library.path=$LIBPATH -classpath "${CLASSPATH}" org.apache.hop.www.HopServer "$@"
EXITCODE=$?
cd ${ORIGINDIR}
diff --git a/docker/resources/load-and-execute.sh b/docker/resources/load-and-execute.sh
index fac1523..f6b5578 100755
--- a/docker/resources/load-and-execute.sh
+++ b/docker/resources/load-and-execute.sh
@@ -201,7 +201,7 @@ if [ -z "${HOP_FILE_PATH}" ]; then
write_server_config
log "Starting a hop-server on port "${HOP_SERVER_PORT}
"${DEPLOYMENT_PATH}"/hop/hop-server.sh \
- ${HOP_EXEC_OPTIONS} \
+ "${HOP_EXEC_OPTIONS}" \
/tmp/hop-server.xml \
2>&1 | tee ${HOP_LOG_PATH}
diff --git a/engine/pom.xml b/engine/pom.xml
index 1874bcf..b730066 100644
--- a/engine/pom.xml
+++ b/engine/pom.xml
@@ -50,7 +50,7 @@
<commons-cli.version>1.2</commons-cli.version>
<javax.servlet-api.version>3.1.0</javax.servlet-api.version>
<javax.websocket-api.version>1.1</javax.websocket-api.version>
- <picocli-version>3.7.0</picocli-version>
+ <picocli-version>4.6.3</picocli-version>
<json-simple.version>1.1.1</json-simple.version>
<commons-vfs2.version>2.9.0</commons-vfs2.version>
</properties>
diff --git a/engine/src/main/java/org/apache/hop/www/HopServer.java b/engine/src/main/java/org/apache/hop/www/HopServer.java
index 518b7ef..8fbf1a9 100644
--- a/engine/src/main/java/org/apache/hop/www/HopServer.java
+++ b/engine/src/main/java/org/apache/hop/www/HopServer.java
@@ -62,6 +62,7 @@ import picocli.CommandLine.Parameters;
import java.util.Date;
import java.util.List;
import java.util.Map;
+import java.util.stream.Stream;
public class HopServer implements Runnable, IHasHopMetadataProvider {
private static final Class<?> PKG = HopServer.class; // For Translator
@@ -441,6 +442,11 @@ public class HopServer implements Runnable, IHasHopMetadataProvider {
}
public static void main(String[] args) {
+ String[] arguments =
+ Stream.of(args)
+ .flatMap(a -> Stream.of(a.split("(?=--)")))
+ .filter(a -> !a.isEmpty())
+ .toArray(String[]::new);
HopServer hopServer = new HopServer();
@@ -448,7 +454,6 @@ public class HopServer implements Runnable, IHasHopMetadataProvider {
// Create the command line options...
//
picocli.CommandLine cmd = new picocli.CommandLine(hopServer);
-
// Apply the system properties to the JVM
//
hopServer.applySystemProperties();
@@ -465,7 +470,7 @@ public class HopServer implements Runnable, IHasHopMetadataProvider {
// Clear the jar file cache so that we don't waste memory...
//
JarCache.getInstance().clear();
-
+
// Set up the metadata to use
//
hopServer.metadataProvider =
@@ -490,7 +495,7 @@ public class HopServer implements Runnable, IHasHopMetadataProvider {
// This will calculate the option values and put them in HopRun or the plugin classes
//
- picocli.CommandLine.ParseResult parseResult = cmd.parseArgs(args);
+ picocli.CommandLine.ParseResult parseResult = cmd.parseArgs(arguments);
if (picocli.CommandLine.printHelpIfRequested(parseResult)) {
printExtraUsageExamples();
@@ -633,7 +638,6 @@ public class HopServer implements Runnable, IHasHopMetadataProvider {
public HopServerCommandException(final String message, final Throwable cause) {
super(message, cause);
}
-
}
/**