Xep 0202 Entity Time

Hi!

I’m trying to get the time of an entity (the server of the user in this case), i’m using smack 4.1.5

I suppose that i have to do something like this:

EntityTimeManager timeManager = EntityTimeManager.getInstanceFor(connection);
String time = timeManager.getTime("jabber.at").getUtc();

This give me the next error:

org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: service-unavailable - cancel

at org.jivesoftware.smack.XMPPException$XMPPErrorException.ifHasErrorThenThrow(XMP PException.java:135)

at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:2 32)

at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:2 13)

at org.jivesoftware.smackx.time.EntityTimeManager.getTime(EntityTimeManager.java:1 11)

Looking at the debug window, i can see that the problem is that in the iq request, the “to” parameter is missing:

<iq id="8NVJ2-22" type="get">
  <time xmlns="urn:xmpp:time"/>
</iq>

Is this a bug or i am doing something wrong?

Thanks in advance

No, it is a bug in Smack. Thanks for reporting https://igniterealtime.org/issues/browse/SMACK-716

I’ve uploaded Smack 4.1.7-SNAPSHOT, which includes a fix for this, to Maven Central’s snapshot repositories. Could you try it out and report back if it solves the issue for you?

Thanks for the quick answer and solution

The fix works perfect!!