Skip to content

Commit 3850567

Browse files
authored
Merge pull request #344 from jmtd/OPENJDK-1551-JAVA_APP_NAME
[Openjdk-1551] JAVA_APP_NAME quoting/interpolation issues
2 parents 8eb001a + 17c78ca commit 3850567

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

modules/run/artifacts/opt/jboss/container/java/run/run-java.sh

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,6 @@ get_classpath() {
182182
echo "${cp_path}"
183183
}
184184

185-
# Set process name if possible
186-
get_exec_args() {
187-
if [ "x${JAVA_APP_NAME}" != x ]; then
188-
echo "-a '${JAVA_APP_NAME}'"
189-
fi
190-
}
191-
192185
# Start JVM
193186
startup() {
194187
# Initialize environment
@@ -201,8 +194,11 @@ startup() {
201194
else
202195
args="-jar ${JAVA_APP_JAR}"
203196
fi
204-
log_info "exec $(get_exec_args) java $(get_java_options) -cp \"$(get_classpath)\" ${args} $*"
205-
exec $(get_exec_args) java $(get_java_options) -cp "$(get_classpath)" ${args} $*
197+
198+
procname="${JAVA_APP_NAME-java}"
199+
200+
log_info "exec -a \"${procname}\" java $(get_java_options) -cp \"$(get_classpath)\" ${args} $*"
201+
exec -a "${procname}" java $(get_java_options) -cp "$(get_classpath)" ${args} $*
206202
}
207203

208204
# =============================================================================

tests/features/java/runtime.feature

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,16 @@ Feature: Openshift OpenJDK Runtime tests
2828

2929
@ubi9
3030
Scenario: Check JAVA_OPTS overrides JAVA_OPTS_APPEND
31-
piv
3231
Given container is started with env
3332
| variable | value |
3433
| JAVA_OPTS | -verbose:gc |
3534
| JAVA_OPTS_APPEND | -Xint |
3635
Then container log should contain -verbose:gc
3736
And container log should not contain -Xint
37+
38+
@ubi9
39+
Scenario: Check JAVA_APP_NAME can contain spaces (OPENJDK-1551)
40+
Given container is started with env
41+
| variable | value |
42+
| JAVA_APP_NAME | foo bar |
43+
Then container log should not contain exec: bar': not found

0 commit comments

Comments
 (0)