[
https://issues.apache.org/jira/browse/DIRAPI-284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15449329#comment-15449329
]
TvT commented on DIRAPI-284:
----------------------------
--- DateUtils.java-revBASE.svn002.tmp.java Di Aug 30 17:27:06 2016
+++ DateUtils.java Di Aug 30 17:31:50 2016
@@ -89,0 +90,21 @@ public final class DateUtils
+
+ /**
+ * Converts the 18-digit Active Directory timestamps, also named
'Windows NT time format' or 'Win32 FILETIME or SYSTEMTIME'.
+ * These are used in Microsoft Active Directory for pwdLastSet,
accountExpires, LastLogon, LastLogonTimestamp and LastPwdSet.
+ * The timestamp is the number of 100-nanoseconds intervals (1
nanosecond = one billionth of a second) since Jan 1, 1601 UTC.
+ * <p>
+ *
+ * @param intervalDate 18-digit number. Time in 100-nanoseconds
intervals since 1.1.1601
+ * @return Date the converted date
+ */
+ private Date convertIntervalDate(String intervalDate){
+ if ( intervalDate == null ){
+ throw new ParseException( I18n.err( I18n.ERR_04359 ), 0
);
+ }
+
+ long offset = 11644473600000L; // offset milliseconds from Jan
1, 1601 to Jan 1, 1970
+ // convert 100-nanosecond intervals to milliseconds
+ long javaTime = (Long.parseLong(intervalDate) / 10000 - offset);
+
+ return new Date(javaTime);
+ }
> 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
> Fix For: 1.0.0-RC2
>
>
> 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)