Skip to content

Commit aabfc7e

Browse files
committed
escape -> split (minor)
1 parent 45a1eb9 commit aabfc7e

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

bin/spark-class

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ if [ -e "$FWDIR/conf/java-opts" ] ; then
112112
JAVA_OPTS="$JAVA_OPTS `cat $FWDIR/conf/java-opts`"
113113
fi
114114

115-
# Escape JAVA_OPTS properly to handle whitespace, double quotes and backslashes
116-
# This exports the escaped java options into ESCAPED_JAVA_OPTS
117-
escape_java_options "$JAVA_OPTS"
115+
# Split JAVA_OPTS properly to handle whitespace, double quotes and backslashes
116+
# This exports the split java options into SPLIT_JAVA_OPTS
117+
split_java_options "$JAVA_OPTS"
118118

119119
# Attention: when changing the way the JAVA_OPTS are assembled, the change must be reflected in CommandUtils.scala!
120120

@@ -159,10 +159,10 @@ export CLASSPATH
159159
if [ "$SPARK_PRINT_LAUNCH_COMMAND" == "1" ]; then
160160
# Put quotes around system properties in case they contain spaces
161161
# This exports the resulting list of java opts into QUOTED_JAVA_OPTS
162-
quote_java_property "${ESCAPED_JAVA_OPTS[@]}"
162+
quote_java_property "${SPLIT_JAVA_OPTS[@]}"
163163
echo -n "Spark Command: " 1>&2
164164
echo "$RUNNER" -cp "$CLASSPATH" "${QUOTED_JAVA_OPTS[@]}" "$@" 1>&2
165165
echo -e "========================================\n" 1>&2
166166
fi
167167

168-
exec "$RUNNER" -cp "$CLASSPATH" "${ESCAPED_JAVA_OPTS[@]}" "$@"
168+
exec "$RUNNER" -cp "$CLASSPATH" "${SPLIT_JAVA_OPTS[@]}" "$@"

bin/utils.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ parse_java_property() {
3535
export JAVA_PROPERTY_VALUE
3636
}
3737

38-
# Properly escape java options, dealing with whitespace, double quotes and backslashes.
39-
# This accepts a string and returns the escaped list through ESCAPED_JAVA_OPTS.
40-
escape_java_options() {
41-
ESCAPED_JAVA_OPTS=() # return value
42-
option_buffer="" # buffer for collecting parts of an option
43-
opened_quotes=0 # whether we are expecting a closing double quotes
38+
# Properly split java options, dealing with whitespace, double quotes and backslashes.
39+
# This accepts a string and returns the resulting list through SPLIT_JAVA_OPTS.
40+
split_java_options() {
41+
SPLIT_JAVA_OPTS=() # return value
42+
option_buffer="" # buffer for collecting parts of an option
43+
opened_quotes=0 # whether we are expecting a closing double quotes
4444
for word in $1; do
4545
contains_quote=$(echo "$word" | sed "s/\\\\\"//g" | grep "\"")
4646
if [[ -n "$contains_quote" ]]; then
@@ -49,7 +49,7 @@ escape_java_options() {
4949
fi
5050
if [[ $opened_quotes == 0 ]]; then
5151
# Remove all non-escaped quotes around the value
52-
ESCAPED_JAVA_OPTS+=("$(
52+
SPLIT_JAVA_OPTS+=("$(
5353
echo "$option_buffer $word" | \
5454
sed "s/^[[:space:]]*//" | \
5555
sed "s/\([^\\]\)\"/\1/g" | \
@@ -66,7 +66,7 @@ escape_java_options() {
6666
echo "Java options parse error! Expecting closing double quotes." 1>&2
6767
exit 1
6868
fi
69-
export ESCAPED_JAVA_OPTS
69+
export SPLIT_JAVA_OPTS
7070
}
7171

7272
# Put double quotes around each of the given java options that is a system property.

0 commit comments

Comments
 (0)