Skip to content

Commit 9788dff

Browse files
authored
Merge pull request #346 from jmtd/OPENJDK-104-JAVA_APP_NAME
[RHEL8] JAVA_APP_NAME breaks if contains whitespace, incorrectly wraps with quotes
2 parents 8da45db + c8245b1 commit 9788dff

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
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
@@ -195,13 +195,6 @@ get_classpath() {
195195
echo "${cp_path}"
196196
}
197197

198-
# Set process name if possible
199-
get_exec_args() {
200-
if [ "x${JAVA_APP_NAME}" != x ]; then
201-
echo "-a '${JAVA_APP_NAME}'"
202-
fi
203-
}
204-
205198
# Ensure that the running UID has the "jboss" passwd metadata
206199
# XXX: Maybe we should make this an entrypoint for the image?
207200
function configure_passwd() {
@@ -226,8 +219,11 @@ startup() {
226219
else
227220
args="-jar ${JAVA_APP_JAR}"
228221
fi
229-
log_info "exec $(get_exec_args) java $(get_java_options) -cp \"$(get_classpath)\" ${args} $*"
230-
exec $(get_exec_args) java $(get_java_options) -cp "$(get_classpath)" ${args} $*
222+
223+
procname="${JAVA_APP_NAME-java}"
224+
225+
log_info "exec -a \"${procname}\" java $(get_java_options) -cp \"$(get_classpath)\" ${args} $*"
226+
exec -a "${procname}" java $(get_java_options) -cp "$(get_classpath)" ${args} $*
231227
}
232228

233229
# =============================================================================

tests/features/java/runtime.feature

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,10 @@ Feature: Openshift OpenJDK Runtime tests
3535
| variable | value |
3636
| JAVA_ARGS | unique |
3737
Then container log should not contain unique unique
38+
39+
@ubi8
40+
Scenario: Check JAVA_APP_NAME can contain spaces (OPENJDK-104)
41+
Given container is started with env
42+
| variable | value |
43+
| JAVA_APP_NAME | foo bar |
44+
Then container log should not contain exec: bar': not found

0 commit comments

Comments
 (0)