diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b0244500c..39e83430e 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -22,6 +22,7 @@
+ FastDateParser does not handle unterminated quotes correctly
FastDateParser does not handle white-space properly
FastDateParser does not handle non-Gregorian calendars properly
FastDateParser does not handle non-ASCII digits correctly
diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
index 8df302f9c..38857c74b 100644
--- a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
+++ b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
@@ -141,6 +141,9 @@ public class FastDateParser implements DateParser, Serializable {
currentFormatField= nextFormatField;
currentStrategy= nextStrategy;
}
+ if (patternMatcher.regionStart() != patternMatcher.regionEnd()) {
+ throw new IllegalArgumentException("Failed to parse \""+pattern+"\" ; gave up at index "+patternMatcher.regionStart());
+ }
if(currentStrategy.addRegex(this, regex)) {
collector.add(currentStrategy);
}
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
index ee5a5008b..e2f12c101 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
@@ -333,6 +333,11 @@ public class FastDateParserTest {
assertEquals(cal.getTime(), fdf.parse("'20030210A'B153320989'"));
}
+ @Test
+ public void testLANG_832() throws Exception {
+ testSdfAndFdp("'d'd" ,"d3", false); // OK
+ testSdfAndFdp("'d'd'","d3", true); // should fail (unterminated quote)
+ }
@Test
public void testLANG_831() throws Exception {