Allow access to parsedPattern for test purposes

Make ParseException text similar to that thrown by SimpleDateFormat

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1390778 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2012-09-27 00:02:58 +00:00
parent c03f033c1c
commit 192b1e1b6b
1 changed files with 7 additions and 2 deletions

View File

@ -175,6 +175,11 @@ public class FastDateParser implements DateParser, Serializable {
return locale;
}
// Give access to generated pattern for test code
Pattern getParsePattern() {
return parsePattern;
}
// Basics
//-----------------------------------------------------------------------
/**
@ -248,9 +253,9 @@ public class FastDateParser implements DateParser, Serializable {
if (locale.equals(JAPANESE_IMPERIAL)) {
throw new ParseException(
"(The " +locale + " locale does not support dates before 1868 AD)\n" +
source+" does not match "+parsePattern.pattern(), 0);
"Unparseable date: \""+source+"\" does not match "+parsePattern.pattern(), 0);
}
throw new ParseException(source+" does not match "+parsePattern.pattern(), 0);
throw new ParseException("Unparseable date: \""+source+"\" does not match "+parsePattern.pattern(), 0);
}
return date;
}