powered by Jive Software

Smack 4.2.4 public static XMPPError.Builder parseError(XmlPullParser parser) in PacketParserUtils class has problem



Smack has problem in “Parses error sub-packets” with the following server IQ error stanza received from server.
I have applied below simple patches to temporary fix the problem. There are two issues with the code i.e.

  1. parser.getAttributeValue("", “type”) will return null
  2. Builder ‘condition’ cannot be null


        // Parse the error header
        String errorType = parser.getAttributeValue("", "type");
        if (StringUtils.isNullOrEmpty(errorType))

        // builder.setType(XMPPError.Type.fromString(parser.getAttributeValue("", "type")));
        builder.setErrorGenerator(parser.getAttributeValue("", "by"));

Smack Log:

05-25 14:05:56.590 7806-8403/org.atalk.android D/SMACK: RECV (0): <iq xmlns="jabber:client" id="962Pu-65" type="error" from="test5@marketing3.office.kontent.cc" to="test5@marketing3.office.kontent.cc/atalk">
       <pubsub xmlns="http://jabber.org/protocol/pubsub">
          <publish node="eu.siacs.conversations.axolotl.bundles:2087096589">
                <bundle xmlns="eu.siacs.conversations.axolotl">
                   <signedPreKeyPublic signedPreKeyId="1">Bdwd5ViSrjuFnfQbj14JabfKhSbTo46fIijeoVhepBkO</signedPreKeyPublic>
                      <preKeyPublic preKeyId="1">Beq1AhaMs/hC+dq+fC94XOdR88D86ulnHaJ+2v3CFS4Q</preKeyPublic>
                      <preKeyPublic preKeyId="100">Bc8BJoEYHYCvOQMtW1n8hE4JHvK4cXmXtqpF/RIAZag9</preKeyPublic>
       <error code="503" />


A patch is usually considered a delta (diff) to the previous version. That makes it easer for other people to see what suggest to change. Could you show us such a diff?


Here is the patch. Please note that this patch is only for reference as I did not include the error code translator.

PacketParserUtil.patch (1.3 KB)


As far as I can tell Smack does everything right here: The ‘type’ attribute of error is mandatory as per RFC 6120 § 8.3.2 (see https://tools.ietf.org/html/rfc6120#section-8.3.2). It appears the pubsub service implementation is violating the RFC. If so, we should fix that.


Thank for the clarification. The user from Germany has indicated that their xmpp server is very old; seems like the implementation is following specifications XEP-0099: IQ Query Action Protocol.

Would appreciate if Smack would consider supporting this variation.
I have removed the patches and use ParsingExceptionCallback instead to handle the issue, so aTalk can continue hinged on the official smack library release.


(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)


i create IM room but the room, i set IM room is persistent:

        // 获得聊天室的配置表单 根据原始表单创建一个要提交的新表单。
        Form form = muc.getConfigurationForm();
        Form answerForm = form.createAnswerForm();

        for(FormField formField:form.getFields()){
//            System.out.println(
//                    "TYPE(类型):"+formField.getType()+ ",Variable(参数):"+formField.getVariable());
            if(formField.getVariable() != null && !formField.getVariable().equals("FORM_TYPE")){

        answerForm.setAnswer("muc#roomconfig_persistentroom", true);
        answerForm.setAnswer("muc#roomconfig_roomowners", owners);

        // 发送已完成的表单(有默认值)到服务器来配置聊天室

the room is create success ,but the room persistent is fail ,
so i look code send message
the xml muc#roomconfig_persistentroom value is 0

i dont now why ? i setAnswer is true why have value is 0