Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit 31d5e31

Browse files
committed
trim whitespace from variables and commandline
1 parent 6040cab commit 31d5e31

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

universalJavaApplicationStub

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ if [ -d "${AppleJavaFolder}" ]; then
100100
JVMMainClass=`/usr/libexec/PlistBuddy -c "print :Java:MainClass" ${InfoPlistFile}`
101101

102102
# read the JVM Options
103-
JVMOptions=`/usr/libexec/PlistBuddy -c "print :Java:Properties" ${InfoPlistFile} | grep " =" | sed 's/^ */-D/g' | tr '\n' ' ' | sed 's/ */ /g' | sed 's/ = /=/g'`
103+
JVMOptions=`/usr/libexec/PlistBuddy -c "print :Java:Properties" ${InfoPlistFile} | grep " =" | sed 's/^ */-D/g' | tr '\n' ' ' | sed 's/ */ /g' | sed 's/ = /=/g' | xargs`
104104

105105
# read the JVM Default Options
106-
JVMDefaultOptions=`/usr/libexec/PlistBuddy -c "print :Java:VMOptions" ${InfoPlistFile}`
106+
JVMDefaultOptions=`/usr/libexec/PlistBuddy -c "print :Java:VMOptions" ${InfoPlistFile} | xargs`
107107

108108
# read the JVM Arguments
109-
JVMArguments=`/usr/libexec/PlistBuddy -c "print :Java:Arguments" ${InfoPlistFile}`
109+
JVMArguments=`/usr/libexec/PlistBuddy -c "print :Java:Arguments" ${InfoPlistFile} | xargs`
110110

111111

112112
# read Info.plist in Oracle style
@@ -119,13 +119,13 @@ elif [ -d "${OracleJavaFolder}" ]; then
119119
JVMMainClass=`/usr/libexec/PlistBuddy -c "print :JVMMainClassName" ${InfoPlistFile}`
120120

121121
# read the JVM Options
122-
JVMOptions=`/usr/libexec/PlistBuddy -c "print :JVMOptions" ${InfoPlistFile} | grep " -" | tr '\n' ' ' | sed 's/ */ /g'`
122+
JVMOptions=`/usr/libexec/PlistBuddy -c "print :JVMOptions" ${InfoPlistFile} | grep " -" | tr '\n' ' ' | sed 's/ */ /g' | xargs`
123123

124124
# read the JVM Default Options
125-
JVMDefaultOptions=`/usr/libexec/PlistBuddy -c "print :JVMDefaultOptions" ${InfoPlistFile} | grep -o "\-.*" | tr '\n' ' '`
125+
JVMDefaultOptions=`/usr/libexec/PlistBuddy -c "print :JVMDefaultOptions" ${InfoPlistFile} | grep -o "\-.*" | tr '\n' ' ' | xargs`
126126

127127
# read the JVM Arguments
128-
JVMArguments=`/usr/libexec/PlistBuddy -c "print :JVMArguments" ${InfoPlistFile} | tr '\n' ' ' | sed -E 's/Array \{ *(.*) *\}/\1/g' | sed 's/ */ /g'`
128+
JVMArguments=`/usr/libexec/PlistBuddy -c "print :JVMArguments" ${InfoPlistFile} | tr '\n' ' ' | sed -E 's/Array \{ *(.*) *\}/\1/g' | sed 's/ */ /g' | xargs`
129129

130130
fi
131131

@@ -184,13 +184,13 @@ elif [ -x "$JAVACMD" ]; then
184184
# - main class
185185
# - JVM arguments
186186
exec "$JAVACMD" \
187-
-cp "${JVMClasspath}" \
188-
-Xdock:icon="$PROGDIR/../Resources/${CFBundleIconFile}" \
189-
-Xdock:name="${CFBundleName}" \
190-
"${JVMOptions}" \
191-
"${JVMDefaultOptions}" \
192-
"${JVMMainClass}" \
193-
"${JVMArguments}"
187+
-cp "${JVMClasspath}" \
188+
-Xdock:icon="$PROGDIR/../Resources/${CFBundleIconFile}" \
189+
-Xdock:name="${CFBundleName}" \
190+
${JVMOptions:+"$JVMOptions" }\
191+
${JVMDefaultOptions:+"$JVMDefaultOptions" }\
192+
"${JVMMainClass}"\
193+
${JVMArguments:+"$JVMArguments"}
194194

195195

196196
else

0 commit comments

Comments
 (0)