diff options
author | Alon Albert <aalbert@google.com> | 2011-02-17 18:10:14 -0800 |
---|---|---|
committer | Alon Albert <aalbert@google.com> | 2011-02-18 09:40:44 -0800 |
commit | 06912bddc6b9db4fd01ed689ca4a8e16b0790244 (patch) | |
tree | ac05480bd3962219be4c8e6a5c9b92a86f29f718 /core/java/android/pim | |
parent | 3259d8853760a72b811757e1711119d041962a1c (diff) | |
download | frameworks_base-06912bddc6b9db4fd01ed689ca4a8e16b0790244.zip frameworks_base-06912bddc6b9db4fd01ed689ca4a8e16b0790244.tar.gz frameworks_base-06912bddc6b9db4fd01ed689ca4a8e16b0790244.tar.bz2 |
Support quoted parameters
iCalendar RFC http://www.ietf.org/rfc/rfc2445.txt says:
4.1.1 List and Field Separators
Property parameters with values containing a COLON, a SEMICOLON or a
COMMA character MUST be placed in quoted text.
So we must be able to support this.
Bug: 3463510
Change-Id: Ie0463fdc2d5cbc340801cc8cc5b4f00e374f2954
Diffstat (limited to 'core/java/android/pim')
-rw-r--r-- | core/java/android/pim/ICalendar.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/pim/ICalendar.java b/core/java/android/pim/ICalendar.java index cc0f45e..9c4eaf4 100644 --- a/core/java/android/pim/ICalendar.java +++ b/core/java/android/pim/ICalendar.java @@ -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; } |