Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0946d63 authored by Alon Albert's avatar Alon Albert Committed by Android Git Automerger
Browse files

am 1aba843d: am ccc802e1: Merge "Support quoted parameters" into gingerbread

* commit '1aba843d':
  Support quoted parameters
parents 190d4e29 1aba843d
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -578,6 +578,23 @@ public class ICalendar {
                            + text);
                }
                parameter.name = text.substring(startIndex + 1, equalIndex);
            } else if (c == '"') {
                if (parameter == null) {
                    throw new FormatException("Expected parameter before '\"' in " + text);
                }
                if (equalIndex == -1) {
                    throw new FormatException("Expected '=' within parameter in " + text);
                }
                if (state.index > equalIndex + 1) {
                    throw new FormatException("Parameter value cannot contain a '\"' in " + text);
                }
                final int endQuote = text.indexOf('"', state.index + 1);
                if (endQuote < 0) {
                    throw new FormatException("Expected closing '\"' in " + text);
                }
                parameter.value = text.substring(state.index + 1, endQuote);
                state.index = endQuote + 1;
                return parameter;
            }
            ++state.index;
        }