commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Jelsma (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1202) parseDateStrictly does't pass specified locale
Date Mon, 18 Jan 2016 16:49:39 GMT

    [ https://issues.apache.org/jira/browse/LANG-1202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15105510#comment-15105510
] 

Markus Jelsma commented on LANG-1202:
-------------------------------------

Anyway, these are the changes due to lack of producing a normal patch file

{code}
    @Test
    public void testLANG799whichDidNotWork() throws ParseException {
        DateUtils.parseDateStrictly("09 abril 2008 23:55:38 GMT", new Locale("es"), new String[]{"dd
MMM yyyy HH:mm:ss zzz"});
    }
{code}

{code}
    /**
     * <p>Parses a string representing a date by trying a variety of different parsers,
     * using the default date format symbols for the given locale..</p>
     * 
     * <p>The parse will try each parse pattern in turn.
     * A parse is only deemed successful if it parses the whole of the input string.
     * If no parse patterns match, a ParseException is thrown.</p>
     * The parser parses strictly - it does not allow for dates such as "February 942, 1996".

     * 
     * @param str  the date to parse, not null
     * @param locale the locale whose date format symbols should be used. If <code>null</code>,
     * the system locale is used (as per {@link #parseDateStrictly(String, String...)}).
     * @param parsePatterns  the date format patterns to use, see SimpleDateFormat, not null
     * @return the parsed date
     * @throws IllegalArgumentException if the date string or pattern array is null
     * @throws ParseException if none of the date patterns were suitable
     * @since 3.2
     */
    public static Date parseDateStrictly(final String str, final Locale locale, final String...
parsePatterns) throws ParseException {
        return parseDateWithLeniency(str, locale, parsePatterns, false);
    }  
{code}

> parseDateStrictly does't pass specified locale
> ----------------------------------------------
>
>                 Key: LANG-1202
>                 URL: https://issues.apache.org/jira/browse/LANG-1202
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.time.*
>    Affects Versions: 3.4
>            Reporter: Markus Jelsma
>             Fix For: 3.5
>
>         Attachments: LANG-1202.patch
>
>
> LANG-799 added support for specifying a locale, but parseDateStrictly() doesn't pass
it to the final parseDateWithLeniency() method.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message