AnsweredAssumed Answered

ParseException in message delay stamp due to microseconds

Question asked by philwinder on Sep 16, 2014
Latest reply on Sep 19, 2014 by philwinder

Hi,

I'm using eJabberd as my xmpp server. For reasons not completely clear to me, it returns microseconds in the stamp property of the delay element. When this is parsed by the XMPPDateTime methods in smack, it passes the match test thanks to the pattern that satisfys DateFormatType.XEP_0082_TIME_MILLIS_ZONE_PROFILE.

 

Unfortunately, all of Java's inbuilt DateFormat tools do not work with microseconds and produce a ParseException if you try.

 

According to XEP-0082, (http://xmpp.org/extensions/xep-0082.html#sect-idp267120) the fractional seconds can contain "any number of digits". So, technically, the eJabberd implementation is not incorrect.

 

I suspect that the simplest option is to chop off all but three numbers after the decimal point and before the z. The affected method is on line 94 of XMPPDateTime, but you might want to perform the operation before then.

 

Thanks,

Phil

Outcomes