directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Lecharny (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DIRAPI-241) new GeneralizedTime(String) fails for fraction close to one
Date Wed, 01 Jul 2015 15:51:04 GMT

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

Emmanuel Lecharny commented on DIRAPI-241:
------------------------------------------

We can make it work up to 6 digits (and that would be microseconds, not nanoseconds). Actully,
I chcked at the {{ISO8601}} specs that does not give any limit to the number of digits.

Clearly, my proposed fix is not enough.

> new GeneralizedTime(String) fails for fraction close to one
> -----------------------------------------------------------
>
>                 Key: DIRAPI-241
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-241
>             Project: Directory Client API
>          Issue Type: Bug
>    Affects Versions: 1.0.0-M30
>            Reporter: Max Fichtelmann
>            Priority: Minor
>
> When parsing a time with a resolution of nanos (like generated by the openldap ppolicy
overlay) it results in a Time that fails to be parsed by org.apache.directory.api.util.GeneralizedTime.GeneralizedTime(String)
> Test:
> {code:title=Test.java|borderStyle=solid}
>     static DateFormat FORMAT = new SimpleDateFormat( "dd/MM/yyyy HH:mm:ss.SSSS z" );
>     
>     @Test
>     public void fractionCloseToOne() throws ParseException
>     {
>         GeneralizedTime close = new GeneralizedTime( "20000101000000.9994Z" );
>         
>         assertThat( close.getDate(), is( equalTo( FORMAT.parse( "01/01/2000 00:00:00.999
GMT" ) ) ) );
>         
>         GeneralizedTime closer = new GeneralizedTime( "20000101000000.9995Z" );
>         
>         assertThat( closer.getDate(), is( equalTo( FORMAT.parse( "01/01/2000 00:00:01
GMT" ) ) ) );
>     }
> {code}



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

Mime
View raw message