Skip to content

Commit

Permalink
Fix bug: count the number of quotes instead of detecting presence
Browse files Browse the repository at this point in the history
A java option of -Dfoo="bar" would fail this previously, because
there are two quotes around bar, but we only detected open quotes
by the presence of the double quote character.
  • Loading branch information
andrewor14 committed Aug 8, 2014
1 parent c2273fc commit b3c4cd5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ split_java_options() {
option_buffer="" # buffer for collecting parts of an option
opened_quotes=0 # whether we are expecting a closing double quotes
for word in $1; do
contains_quote=$(echo "$word" | sed "s/\\\\\"//g" | grep "\"")
if [[ -n "$contains_quote" ]]; then
num_quotes=$(echo "$word" | sed "s/\\\\\"//g" | grep -o "\"" | grep -c .)
if [[ $((num_quotes % 2)) == 1 ]]; then
# Flip the bit
opened_quotes=$(((opened_quotes + 1) % 2))
fi
Expand Down

0 comments on commit b3c4cd5

Please sign in to comment.