powered by Jive Software

java.text.ParseException: Unparseable date

Hi Flow,

For Offline messages our server adds this to every message:

but then smack library disconnects from the server and in print this to logcat:

02-23 17:15:58.514 4258-4610/**** W/AbstractXMPPConnection﹕ Connection closed with error

org.jivesoftware.smack.SmackException: java.text.ParseException: Unparseable date: “20150223T14:18:31.135551” (at offset 8)

at org.jivesoftware.smackx.delay.provider.AbstractDelayInformationProvider.parse(A bstractDelayInformationProvider.java:58)

at org.jivesoftware.smackx.delay.provider.AbstractDelayInformationProvider.parse(A bstractDelayInformationProvider.java:29)

at org.jivesoftware.smack.provider.Provider.parse(Provider.java:35)

at org.jivesoftware.smack.util.PacketParserUtils.parsePacketExtension(PacketParser Utils.java:910)

at org.jivesoftware.smack.util.PacketParserUtils.addPacketExtension(PacketParserUt ils.java:1016)

at org.jivesoftware.smack.util.PacketParserUtils.parseMessage(PacketParserUtils.ja va:287)

at org.jivesoftware.smack.util.PacketParserUtils.parseStanza(PacketParserUtils.jav a:151)

at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMP PConnection.java:978)

at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$400(XMPPTCPConnection.java: 139)

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC onnection.java:966)

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPCon nection.java:921)

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnecti on.java:936)

at java.lang.Thread.run(Thread.java:856)

Caused by: java.text.ParseException: Unparseable date: “20150223T14:18:31.135551” (at offset 8)

at java.text.DateFormat.parse(DateFormat.java:622)

at org.jxmpp.util.XmppDateTime$DateFormatType.parse(XmppDateTime.java:112)

at org.jxmpp.util.XmppDateTime.parseXEP0082Date(XmppDateTime.java:163)

at org.jxmpp.util.XmppDateTime.parseDate(XmppDateTime.java:204)

at org.jivesoftware.smackx.delay.provider.LegacyDelayInformationProvider.parseDate (LegacyDelayInformationProvider.java:33)

at org.jivesoftware.smackx.delay.provider.AbstractDelayInformationProvider.parse(A bstractDelayInformationProvider.java:56)

at org.jivesoftware.smackx.delay.provider.AbstractDelayInformationProvider.parse(A bstractDelayInformationProvider.java:29)

at org.jivesoftware.smack.provider.Provider.parse(Provider.java:35)

at org.jivesoftware.smack.util.PacketParserUtils.parsePacketExtension(PacketParser Utils.java:910)

at org.jivesoftware.smack.util.PacketParserUtils.addPacketExtension(PacketParserUt ils.java:1016)

at org.jivesoftware.smack.util.PacketParserUtils.parseMessage(PacketParserUtils.ja va:287)

at org.jivesoftware.smack.util.PacketParserUtils.parseStanza(PacketParserUtils.jav a:151)

at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMP PConnection.java:978)

at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$400(XMPPTCPConnection.java: 139)

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC onnection.java:966)

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPCon nection.java:921)

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnecti on.java:936)

at java.lang.Thread.run(Thread.java:856)

I went through smack code and problem is in this pattern:

jxmpp/XmppDateTime.java at master · igniterealtime/jxmpp · GitHub

It does not match because our server adds milliseconds in timestamp

This is not a valid XEP-82 date format, because the timezone definition (TZD) is missing.

Also XEP-91 is deprecated, consider using XEP-203.

1 Like

Please tell me more detail. How to use XEP-203 in my SMACK project.I am so confused…please

Dose it work? How do you use XEP-203?

Hi,

Can you please help me how to use XEP 203. I am using Ejabberd 14.02 version. Please help me I am unable to get offline messages in my client. It was working fine before updating to smack 4.1. So I think might be some functionality is missed in new version of smack.

Thanks

// Delayed Delivery
ProviderManager.addExtensionProvider(“x”,“jabber:x:delay”, new DelayInformationProvider());

change to

// Delayed Delivery
ProviderManager.addExtensionProvider(“x”,“jabber:x:delay”, new LegacyDelayInformationProvider());

can solve this problem!

this is not working on Smack 4.1.5 , can you explain more about where set this new extension provider

Same problem, any fix?

Same problem! Has anyone found a solution?

@Andrei @Stefan hennemann @Yesid Lazaro

(1) define your own com.xxx.xmppplugin.LegacyDelayInformationProvider

package com.xxx.xmppplugin

public class LegacyDelayInformationProvider extends AbstractDelayInformationProvider {

  • @Override*

  • protected Date parseDate(String string) throws ParseException {*

  • SimpleDateFormat sfd = new SimpleDateFormat(“yyyyMMdd’T’HH:mm:ss.SSSSSS”);*

  • return sfd.parse(string);*

  •    //return XmppDateTime.parseDate(string);*
    
  • }*

}

(2) use during connection creation ->

ProviderManager.addExtensionProvider(“x”,“jabber:x:delay”, new com.xxx.xmppplugin.LegacyDelayInformationProvider());