powered by Jive Software

Smack 4.4.6: XML TransformerFactory does not support indent-number attribute

During aTalk legacy File Transfer debugging, smack returns an IllegalArgumentException on receiving the remote Si-Transfer request.
What is the root cause of the problem?
No sure if there is something aTalk done incorrectly.

2022-07-16 04:57:35.568 22212-22631/org.atalk.android D/SMACK: RECV (0): 
    <iq xml:lang='en' to='peacock@atalk.sytes.net/atalk' from='swordfish@atalk.sytes.net/atalk' type='set' id='Z977M-92'>
      <si xmlns='http://jabber.org/protocol/si' id='jsi_1609371131' mime-type='image/png' profile='http://jabber.org/protocol/si/profile/file-transfer'>
        <file xmlns='http://jabber.org/protocol/si/profile/file-transfer' name='Prudential_JB.png' size='1191179'>
          <desc>
            Sending file
          </desc>
        </file>
        <feature xmlns='http://jabber.org/protocol/feature-neg'>
          <x xmlns='jabber:x:data' type='form'>
            <field var='stream-method' type='list-single'>
              <option>
                <value>
                  http://jabber.org/protocol/bytestreams
                </value>
              </option>
              <option>
                <value>
                  http://jabber.org/protocol/ibb
                </value>
              </option>
            </field>
          </x>
        </feature>
      </si>
    </iq>
2022-07-16 04:57:35.640 22212-22631/org.atalk.android I/aTalk: [65555] org.jivesoftware.smack.util.XmlUtil.<clinit>() XML TransformerFactory does not support indent-number attribute
    java.lang.IllegalArgumentException: Not supported: indent-number
        at org.apache.xalan.processor.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:580)
        at org.jivesoftware.smack.util.XmlUtil.<clinit>(XmlUtil.java:39)
        at org.jivesoftware.smack.util.XmlUtil.isClarkNotation(XmlUtil.java:69)
        at org.jivesoftware.smackx.formtypes.FormFieldRegistry.register(FormFieldRegistry.java:81)
        at org.jivesoftware.smackx.formtypes.FormFieldRegistry.register(FormFieldRegistry.java:66)
        at org.jivesoftware.smackx.xdata.packet.DataForm.<init>(DataForm.java:112)
        at org.jivesoftware.smackx.xdata.packet.DataForm.<init>(DataForm.java:54)
        at org.jivesoftware.smackx.xdata.packet.DataForm$Builder.build(DataForm.java:561)
        at org.jivesoftware.smackx.xdata.provider.DataFormProvider.parse(DataFormProvider.java:139)
        at org.jivesoftware.smackx.xdata.provider.DataFormProvider.parse(DataFormProvider.java:61)
        at org.jivesoftware.smack.provider.Provider.parse(Provider.java:53)
        at org.jivesoftware.smack.provider.Provider.parse(Provider.java:43)
        at org.jivesoftware.smackx.thumbnail.ThumbnailStreamInitiationProvider.parse(ThumbnailStreamInitiationProvider.java:91)
        at org.jivesoftware.smackx.thumbnail.ThumbnailStreamInitiationProvider.parse(ThumbnailStreamInitiationProvider.java:39)
        at org.jivesoftware.smack.provider.IQProvider.parse(IQProvider.java:64)
        at org.jivesoftware.smack.provider.IqProvider.parse(IqProvider.java:40)
        at org.jivesoftware.smack.util.PacketParserUtils.parseIQ(PacketParserUtils.java:555)
        at org.jivesoftware.smack.util.PacketParserUtils.parseStanza(PacketParserUtils.java:113)
        at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMPPConnection.java:1450)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$1000(XMPPTCPConnection.java:131)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:972)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$700(XMPPTCPConnection.java:916)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:939)
        at java.lang.Thread.run(Thread.java:764)
2022-07-16 04:57:35.646 22212-22629/org.atalk.android D/(OperationSetFileTransferJabberImpl.java:393)#fileTransferRequest: Received incoming Jabber file transfer request.

2022-07-16 04:59:09.857 22212-22630/org.atalk.android D/SMACK: SENT (0): 
    <iq to='swordfish@atalk.sytes.net/atalk' id='Z977M-92' type='result'>
      <si xmlns='http://jabber.org/protocol/si'>
        <feature xmlns="http://jabber.org/protocol/feature-neg">
          <x xmlns='jabber:x:data' type='submit'>
            <field var='stream-method'>
              <value>
                http://jabber.org/protocol/bytestreams
              </value>
            </field>
          </x>
        </feature>
      </si>
    </iq>

It is not visible from the log, but that is a exception logged using ‘info’ log level. Check the call site, i.e., the address of the second topmost entry of the stack trace, org.jivesoftware.smack.util.XmlUtil.(XmlUtil.java:39), to see the JUL log call.

Smack merely wants to tell you what a certain non-necessary functionality is not available.

Below is the captured log that leads to the above problem; when smack is trying to register a form field (formType == null) i.e. <field var=‘stream-method’ type=‘list-single’>

at org.jivesoftware.smackx.formtypes.FormFieldRegistry.register(FormFieldRegistry.java:85)

and XmlUtil throws the exception; else everything is working OK.
No sure if smack team needs to take any action; aTalk will just ignore it for now.

    public static void register(String formType, String fieldName, FormField.Type fieldType) {
        StringUtils.requireNotNullNorEmpty(fieldName, "fieldName must be provided");
        Objects.requireNonNull(fieldType);

        Timber.d("formType: %s; fieldName: %s;  FormField.Type: %s", formType, fieldName, fieldType);
        if (formType == null) {
            if (XmlUtil.isClarkNotation(fieldName)) {
                CLARK_NOTATION_FIELD_REGISTRY.put(fieldName, fieldType);
            }
            return;
        }
    ...
 }

public class XmlUtil {

    private static final TransformerFactory transformerFactory = TransformerFactory.newInstance();

    static {
        try {
            transformerFactory.setAttribute("indent-number", 2);
        } catch (IllegalArgumentException e) {
            LOGGER.log(Level.INFO, "XML TransformerFactory does not support indent-number attribute", e);
        }
    }
...
}
2022-07-19 10:01:24.311 7282-8984/org.atalk.android D/(FormFieldRegistry.java:83)#register: formType: null; fieldName: stream-method;  FormField.Type: list-single
2022-07-19 10:01:24.403 7282-8984/org.atalk.android I/aTalk: [1525] org.jivesoftware.smack.util.XmlUtil.<clinit>() XML TransformerFactory does not support indent-number attribute
    java.lang.IllegalArgumentException: Not supported: indent-number
        at org.apache.xalan.processor.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:580)
        at org.jivesoftware.smack.util.XmlUtil.<clinit>(XmlUtil.java:39)
        at org.jivesoftware.smack.util.XmlUtil.isClarkNotation(XmlUtil.java:69)
        at org.jivesoftware.smackx.formtypes.FormFieldRegistry.register(FormFieldRegistry.java:85)
        at org.jivesoftware.smackx.formtypes.FormFieldRegistry.register(FormFieldRegistry.java:69)
        at org.jivesoftware.smackx.xdata.packet.DataForm.<init>(DataForm.java:112)
        at org.jivesoftware.smackx.xdata.packet.DataForm.<init>(DataForm.java:54)
        at org.jivesoftware.smackx.xdata.packet.DataForm$Builder.build(DataForm.java:561)
        at org.jivesoftware.smackx.filetransfer.FileTransferNegotiator.createDefaultInitiationForm(FileTransferNegotiator.java:375)
        at org.jivesoftware.smackx.filetransfer.FileTransferNegotiator.negotiateOutgoingTransfer(FileTransferNegotiator.java:315)
        at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer.negotiateStream(OutgoingFileTransfer.java:372)
        at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer.access$100(OutgoingFileTransfer.java:44)
        at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer$2.run(OutgoingFileTransfer.java:232)
        at java.lang.Thread.run(Thread.java:920)

Just to be clear, there is no problem. Smack is just telling you that a library used by Smack does not provide all functionality. But the missing functionality is also not essential.

That is also not accurate, as XmlUtil does not throw an exception, it merely catches one and logs it.

I hope this clarifies the significance of the situation. :slight_smile:

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.