powered by Jive Software

XHTMLExtension cannot be cast BoBExtension

I currently using Smack 4.2.0 for Android, and I’m unable to obtain a BoBExtension send by another client.


<?xml version="1.0" encoding="UTF-8"?>

<message to=“to@localhost” from=“from@localhost/test”



<body xmlns="http://www.w3.org/1999/xhtml">

    <img src="cid:base64+YmFzZQ==@bob.xmpp.org"/>


Exception in async packet listener

java.lang.ClassCastException: org.jivesoftware.smackx.xhtmlim.packet.XHTMLExtension cannot be cast to org.jivesoftware.smackx.bob.element.BoBExtension

at org.jivesoftware.smackx.bob.element.BoBExtension.from(BoBExtension.java:93)

at com.messenger.xmpp.XMPPSession.manageMessageReceived(XMPPSession.java:806)

at com.messenger.xmpp.XMPPSession.saveMessage(XMPPSession.java:717)

at com.messenger.xmpp.XMPPSession.access$600(XMPPSession.java:102)

at com.messenger.xmpp.XMPPSession$3.processStanza(XMPPSession.java:256)

at org.jivesoftware.smack.AbstractXMPPConnection$4.run(AbstractXMPPConnection.java :1164)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)

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

A working example can be found in here: mangosta-android/XMPPSession.java at master · esl/mangosta-android · GitHub

But I found out that they are using a modified and precompiled version of Smack 4.2.0-beta3. mangosta-android/app/libs at master · esl/mangosta-android · GitHub

There is a provider for BoBExtension missing. I’ve created SMACK-770.

1 Like

I was looking at the SMACK-770 ticket and I am having a difficult time finding up to date documentation on the XmlPullParser. Is there a website for their current javadocs?

I think there is http://xmlpull.org/v1/doc/api/org/xmlpull/v1/XmlPullParser.html
If you want to work on a Provider, you can also take a look at how other providers are implemented :slight_smile:

Thank you! I had a look at those but they look like they are out of date (1.0.5 vs 1.1.3)? I did have a look at a couple of the provider’s source code but there are a few ways to get the job done. I was just trying to be sure how the parser worked by checking out the source code/docs. I started trying to work on SMACK-770 ticket but I ran into a few “troubles.”