[
https://issues.apache.org/jira/browse/LANG-1769?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Piotr Karwasz updated LANG-1769:
--------------------------------
Issue Type: New Feature (was: Bug)
Priority: Minor (was: Major)
Summary: FastDateFormat only supports SimpleDateFormat lenient mode
(was: FastDateFormat.parse can not handle invalid input data)
> FastDateFormat only supports SimpleDateFormat lenient mode
> ----------------------------------------------------------
>
> Key: LANG-1769
> URL: https://issues.apache.org/jira/browse/LANG-1769
> Project: Commons Lang
> Issue Type: New Feature
> Components: lang.*
> Affects Versions: 3.17.0
> Reporter: Wang Hailong
> Priority: Minor
>
> the input is an invalid data, it should throw an exception, but the
> FastDateFormat.parse just parse it. The output is "Sun Jan 02 00:00:00 CST
> 10000
> "
> {color:#bbb529}@Test
> {color}{color:#cc7832}public void
> {color}{color:#ffc66d}testFastDateFormatWithInvalidMonth{color}()
> {color:#cc7832}throws {color}ParseException {
> {color:#808080}// Create a FastDateParser instance with a valid pattern string
> {color}{color:#808080} {color}FastDateFormat dateParser =
> FastDateFormat.getInstance({color:#6a8759}"MM/dd/yyyy"{color}{color:#cc7832},
> new {color}Locale({color:#6a8759}"en"{color}{color:#cc7832},
> {color}{color:#6a8759}"US"{color})){color:#cc7832};
> {color}{color:#cc7832} {color}{color:#808080}// Attempt to parse an invalid
> month value and expect an exception
> {color}{color:#808080}
> {color}System.{color:#9876aa}out{color}.println(dateParser.parse({color:#6a8759}"13/02/9999"{color})){color:#cc7832};
> {color}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)