diff options
| author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 14:04:24 -0800 |
|---|---|---|
| committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 14:04:24 -0800 |
| commit | 076357b8567458d4b6dfdcf839ef751634cd2bfb (patch) | |
| tree | efbb2fd6f1dc67d2d606382fc3b82983e7cb2e1f /core/java/android/pim | |
| parent | 3dec7d563a2f3e1eb967ce2054a00b6620e3558c (diff) | |
| download | frameworks_base-076357b8567458d4b6dfdcf839ef751634cd2bfb.zip frameworks_base-076357b8567458d4b6dfdcf839ef751634cd2bfb.tar.gz frameworks_base-076357b8567458d4b6dfdcf839ef751634cd2bfb.tar.bz2 | |
auto import from //depot/cupcake/@132589
Diffstat (limited to 'core/java/android/pim')
| -rw-r--r-- | core/java/android/pim/ICalendar.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/core/java/android/pim/ICalendar.java b/core/java/android/pim/ICalendar.java index cc0f45e..4a5d7e4 100644 --- a/core/java/android/pim/ICalendar.java +++ b/core/java/android/pim/ICalendar.java @@ -405,15 +405,13 @@ public class ICalendar { // TODO: get rid of this -- handle all of the parsing in one pass through // the text. private static String normalizeText(String text) { + // first we deal with line folding, by replacing all "\r\n " strings + // with nothing + text = text.replaceAll("\r\n ", ""); + // it's supposed to be \r\n, but not everyone does that text = text.replaceAll("\r\n", "\n"); text = text.replaceAll("\r", "\n"); - - // we deal with line folding, by replacing all "\n " strings - // with nothing. The RFC specifies "\r\n " to be folded, but - // we handle "\n " and "\r " too because we can get those. - text = text.replaceAll("\n ", ""); - return text; } @@ -442,7 +440,7 @@ public class ICalendar { current = parseLine(line, state, current); // if the provided component was null, we will return the root // NOTE: in this case, if the first line is not a BEGIN, a - // FormatException will get thrown. + // FormatException will get thrown. if (component == null) { component = current; } @@ -526,7 +524,8 @@ public class ICalendar { private static String extractValue(ParserState state) throws FormatException { String line = state.line; - if (state.index >= line.length() || line.charAt(state.index) != ':') { + char c = line.charAt(state.index); + if (c != ':') { throw new FormatException("Expected ':' before end of line in " + line); } |
