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

Emmanuel Lecharny commented on DIRAPI-284:
------------------------------------------

Here is a workaround :

{noformat}
    /** A Date far in the future, when Micro$oft would have vanished for a long 
time... */
    private static final Date INFINITE = new Date( 0x7FFFFFFFFFFFFFFFL );

    public static Date getDate( String zuluTime ) throws ParseException
    {
        try 
        {
            return new GeneralizedTime( zuluTime ).calendar.getTime();
        }
        catch ( ParseException pe )
        {
            // Maybe one of the multiple Micro$oft ineptness to cope with 
Standards ?
            if ( "9223372036854775807".equals( zuluTime) )
            {
                // This 0x7FFFFFFFFFFFFFFF, never ending date
                return INFINITE;
            }
            else
            {
                throw pe;
            }
        }
    }
{noformat}

That should fix your issue.

> DateUtils throws an exception for certain timestamps
> ----------------------------------------------------
>
>                 Key: DIRAPI-284
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-284
>             Project: Directory Client API
>          Issue Type: Bug
>    Affects Versions: 1.0.0-RC1
>         Environment: All
>            Reporter: TvT
>
> The DateUtils class can't handle certain timestamps.
> The following code
> _DateUtils.getDate("9223372036854775807");_
> throws an "java.lang.RuntimeException: java.text.ParseException: ERR_04363 
> Invalid Time too short, expected field 'fraction of second' or 'timezone'."
> The value in [microsofts active directory 
> |https://msdn.microsoft.com/en-us/library/ms675098%28v=vs.85%29.aspx]indicates
>  that e.g. an account never expires...



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

Reply via email to