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

Stian Soiland-Reyes commented on BEANUTILS-495:
-----------------------------------------------

Reproducible with:

{code}
        
        DateFormat f = DateFormat.getDateTimeInstance(DateFormat.SHORT, 
DateFormat.SHORT, Locale.US);
        f.setLenient(true);
        f.parse("3/21/06 3:06 PM");
{code}

which works in Java 8, but in Java 9 fails with

{code}
java.text.ParseException: Unparseable date: "3/21/06 3:06 PM"
        at java.text.DateFormat.parse(java.base@9-internal/DateFormat.java:366)
        at 
org.apache.commons.beanutils.converters.SqlTimestampConverterTestCase.testLocale(SqlTimestampConverterTestCase.java:79)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke0(java.base@9-internal/Native Method)
{code}



Detecting workaround in SqlTimestampConverterTestCase - but Locale.US-based 
date parsing would still be sensitive to this. Perhaps this should be raised 
upstream with Open JDK 9 (it might just be a bug in Ubuntu's JDK 9?) - I don't 
think it should fail when 'format.setLenient(true)' is on DateFormat.


> DateConverterTestBase fails on M/d/yy in Java 9
> -----------------------------------------------
>
>                 Key: BEANUTILS-495
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-495
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: ConvertUtils & Converters
>    Affects Versions: 1.9.3
>         Environment: OpenJDK 9, Ubuntu 16.04
>            Reporter: Stian Soiland-Reyes
>            Assignee: Stian Soiland-Reyes
>            Priority: Minor
>             Fix For: 1.9.3
>
>
> {code}
>   
> SqlTimestampConverterTestCase.testLocale:73->DateConverterTestBase.validConversion:403
>  Converting 'java.lang.String' value '3/21/06 3:06 pm' threw 
> org.apache.commons.beanutils.ConversionException: Error converting 'String' 
> to 'java.sql.Timestamp' using pattern 'M/d/yy, h:mm a'
> {code}
> Only seems to happen with Open JDK 9?



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

Reply via email to