risdenk commented on a change in pull request #131: KNOX-1957 - Optional
APP_JAVA_OPTS are handled properly
URL: https://github.com/apache/knox/pull/131#discussion_r315300423
##########
File path: gateway-release/home/bin/knoxcli.sh
##########
@@ -32,15 +32,46 @@ APP_JAR="$APP_BIN_DIR/knoxcli.jar"
# Source common functions
. "$APP_BIN_DIR"/knox-functions.sh
-APP_JAVA_OPTS="$APP_JAVA_LIB_PATH $KNOX_CLI_MEM_OPTS $KNOX_CLI_DBG_OPTS
$KNOX_CLI_LOG_OPTS"
+# JAVA options used by the JVM
+declare -a APP_JAVA_OPTS
+
+function addAppJavaOpts {
+ options_array=$(echo "${1}" | tr " " "\n")
+ for option in ${options_array}
+ do
+ APP_JAVA_OPTS+=("$option")
+ done
+}
+
+function buildAppJavaOpts {
+ if [ -n "$KNOX_CLI_MEM_OPTS" ]; then
+ addAppJavaOpts "${KNOX_CLI_MEM_OPTS}"
+ fi
+
+ if [ -n "$KNOX_CLI_LOG_OPTS" ]; then
+ addAppJavaOpts "${KNOX_CLI_LOG_OPTS}"
+ fi
+
+ if [ -n "$KNOX_CLI_DBG_OPTS" ]; then
+ addAppJavaOpts "${KNOX_CLI_DBG_OPTS}"
+ fi
+
+ if [ -n "$APP_JAVA_LIB_PATH" ]; then
+ addAppJavaOpts "${APP_JAVA_LIB_PATH}"
+ fi
+
+ # echo "APP_JAVA_OPTS =" "${APP_JAVA_OPTS[@]}"
+}
function main {
checkJava
+ buildAppJavaOpts
- #printf "Starting $APP_LABEL \n"
- #printf "$@"
-
- $JAVA "$APP_JAVA_OPTS" -jar "$APP_JAR" "$@" || exit 1
+ if [ ${#APP_JAVA_OPTS[@]} -eq 0 ]; then
+ $JAVA -jar "$APP_JAR" "$@" || exit 1
Review comment:
Same concern as above with not needing this if check
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services