summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2006-08-09 19:42:21 +0000
committerTom Tromey <tromey@redhat.com>2006-08-09 19:42:21 +0000
commit83edeb1c47c8a737d0670da0bc5f2b592533a96d (patch)
treef1f25caeb6fa6e3ce886cc63e649dd443851f018
parent42f94da00ce86a8dfe5e75a16c5e81ac1097a384 (diff)
downloadclasspath-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--ChangeLog6
-rw-r--r--java/text/SimpleDateFormat.java20
2 files changed, 25 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 4721984d3..1402b852a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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;
}