diff options
author | Tom Tromey <tromey@redhat.com> | 2006-08-09 19:42:21 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2006-08-09 19:42:21 +0000 |
commit | 83edeb1c47c8a737d0670da0bc5f2b592533a96d (patch) | |
tree | f1f25caeb6fa6e3ce886cc63e649dd443851f018 | |
parent | 42f94da00ce86a8dfe5e75a16c5e81ac1097a384 (diff) | |
download | classpath-83edeb1c47c8a737d0670da0bc5f2b592533a96d.tar.gz |
PR classpath/28658:
* java/text/SimpleDateFormat.java (parse): Let an unquoted space in
the pattern match any number of spaces in the text.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | java/text/SimpleDateFormat.java | 20 |
2 files changed, 25 insertions, 1 deletions
@@ -1,3 +1,9 @@ +2006-08-09 Tom Tromey <tromey@redhat.com> + + PR classpath/28658: + * java/text/SimpleDateFormat.java (parse): Let an unquoted space in + the pattern match any number of spaces in the text. + 2006-08-09 Sven de Marothy <sven@physto.se> * java/awt/image/BufferedImage.java diff --git a/java/text/SimpleDateFormat.java b/java/text/SimpleDateFormat.java index 2825c7bed..1e1952569 100644 --- a/java/text/SimpleDateFormat.java +++ b/java/text/SimpleDateFormat.java @@ -917,7 +917,25 @@ public class SimpleDateFormat extends DateFormat || ((ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z'))) { - if (! expect (dateStr, pos, ch)) + if (quote_start == -1 && ch == ' ') + { + // A single unquoted space in the pattern may match + // any number of spaces in the input. + int index = pos.getIndex(); + int save = index; + while (index < dateStr.length() + && Character.isWhitespace(dateStr.charAt(index))) + ++index; + if (index > save) + pos.setIndex(index); + else + { + // Didn't see any whitespace. + pos.setErrorIndex(index); + return null; + } + } + else if (! expect (dateStr, pos, ch)) return null; continue; } |