Message body missing

A message sent by other client contains a json extension and body.

But smack give me the message removed body.(4.1Beta1)

In 4.0.x everything is fine.

Please show us the stanza.

Fixed it by add my custom json extension class to replacing smack’s json extension class.

The custom class works fine on 4.0.x, as well as 4.1.

Why did the one from Smack not work for you?

I don’t known.

Here is the custom class:

public JsonExtension parse(XmlPullParser parser, int depth)

throws XmlPullParserException, IOException, SmackException {

StringBuilder content = new StringBuilder();

while (!(parser.next() == XmlPullParser.END_TAG && parser.getDepth() == depth)) {

String text = parser.getText();

if (text == null) {

                throw new IllegalStateException("Parser should never return 'null' on getText() here");

}

content.append(text);

}

return new JsonExtension(content.toString());

}

Which class do you mean in 4.0? IIRC there was no JSON container implementation in 4.0.

I mean the custom class.

Note that Smack 4.1 adds support for XEP-335, which is the preferred way to encapsulate JSON within XMPP: JsonPacketExtension (SMACK-NIGHTLY-JOB1 4.1.0-beta2-SNAPSHOT API)