summaryrefslogtreecommitdiff
path: root/java/text/SimpleDateFormat.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/text/SimpleDateFormat.java')
-rw-r--r--java/text/SimpleDateFormat.java20
1 files changed, 19 insertions, 1 deletions
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;
}