Error after connecting

Hello, I have successfully connected to a server and am receiving responses but I am getting errors after a couple of messages received. It would be great if it was possible to just ignore these errors?

I receive a couple of messages then receive an error (probably an invalid message?), assuming which leads to the error, and the disconnection.

16:05:49 XMPPConnection closed due to an exception (XMPPTCPConnection[xxxx/6p6jux9pub] (0))
java.lang.UnsupportedOperationException
	at org.jxmpp.xml.splitter.XmlSplitter.processChar(XmlSplitter.java:376)
	at org.jxmpp.xml.splitter.XmlSplitter.write(XmlSplitter.java:155)
	at java.base/java.io.Writer.write(Writer.java:290)
	at java.base/java.io.Writer.write(Writer.java:249)
	at java.base/java.io.Writer.append(Writer.java:322)
	at org.jivesoftware.smack.debugger.SmackDebugger.lambda$newConnectionReader$1(SmackDebugger.java:96)
	at org.jivesoftware.smack.util.ObservableReader.read(ObservableReader.java:52)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1699)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanLiteral(XMLEntityScanner.java:1137)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(XMLScanner.java:980)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanAttribute(XMLNSDocumentScannerImpl.java:447)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:250)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2726)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:601)
	at org.jivesoftware.smack.xml.stax.StaxXmlPullParser.next(StaxXmlPullParser.java:191)
	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1143)
	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.base/java.lang.Thread.run(Thread.java:833)

org.jivesoftware.smack.SmackException$NotConnectedException: The connection XMPPTCPConnection[xxxxxx/6p6jux9pub] (0) is no longer connected while waiting for response with AndFilter: (StanzaTypeFilter: Presence, OrFilter: (AndFilter: (FromMatchesFilter (ignoreResourcepart): xxxxxx, MUCUserStatusCodeFilter: status=110), AndFilter: (FromMatchesFilter (full): nxxxxx, StanzaIdFilter: id=X7Y7C-1, PresenceTypeFilter: type=error))) because of java.lang.UnsupportedOperationException
	at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:276)
	at org.jivesoftware.smackx.muc.MultiUserChat.enter(MultiUserChat.java:408)
	at org.jivesoftware.smackx.muc.MultiUserChat.join(MultiUserChat.java:721)
	at org.jivesoftware.smackx.muc.MultiUserChat.join(MultiUserChat.java:680)
	at com.eazyftw.letsweather.alert.NewAlertManager.main(NewAlertManager.java:86)
Caused by: java.lang.UnsupportedOperationException
	at org.jxmpp.xml.splitter.XmlSplitter.processChar(XmlSplitter.java:376)
	at org.jxmpp.xml.splitter.XmlSplitter.write(XmlSplitter.java:155)
	at java.base/java.io.Writer.write(Writer.java:290)
	at java.base/java.io.Writer.write(Writer.java:249)
	at java.base/java.io.Writer.append(Writer.java:322)
	at org.jivesoftware.smack.debugger.SmackDebugger.lambda$newConnectionReader$1(SmackDebugger.java:96)
	at org.jivesoftware.smack.util.ObservableReader.read(ObservableReader.java:52)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1699)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanLiteral(XMLEntityScanner.java:1137)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(XMLScanner.java:980)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanAttribute(XMLNSDocumentScannerImpl.java:447)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:250)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2726)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:601)
	at org.jivesoftware.smack.xml.stax.StaxXmlPullParser.next(StaxXmlPullParser.java:191)
	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1143)
	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.base/java.lang.Thread.run(Thread.java:833)
Jan 06, 2023 4:05:49 PM org.jivesoftware.smack.AbstractXMPPConnection callConnectionClosedOnErrorListener
WARNING: Connection XMPPTCPConnection[xxxxxxx/6p6jux9pub] (0) closed with error
java.lang.UnsupportedOperationException
	at org.jxmpp.xml.splitter.XmlSplitter.processChar(XmlSplitter.java:376)
	at org.jxmpp.xml.splitter.XmlSplitter.write(XmlSplitter.java:155)
	at java.base/java.io.Writer.write(Writer.java:290)
	at java.base/java.io.Writer.write(Writer.java:249)
	at java.base/java.io.Writer.append(Writer.java:322)
	at org.jivesoftware.smack.debugger.SmackDebugger.lambda$newConnectionReader$1(SmackDebugger.java:96)
	at org.jivesoftware.smack.util.ObservableReader.read(ObservableReader.java:52)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1699)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanLiteral(XMLEntityScanner.java:1137)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(XMLScanner.java:980)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanAttribute(XMLNSDocumentScannerImpl.java:447)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:250)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2726)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:601)
	at org.jivesoftware.smack.xml.stax.StaxXmlPullParser.next(StaxXmlPullParser.java:191)
	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1143)
	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.base/java.lang.Thread.run(Thread.java:833)

My smack version is 4.4.6 (4.4.6-4.4 2022-06-29)

Any help greatly appreciated!

This. If you look at the source code XmlSplitter.java:376 you will find that it’s the place where the XmlSplitter rejects XML comments:

because XMPP does not allow comments in the XML stream (cf. RFC 6120 § 11.1).

I think adding an message, explaining this, to the UnsupportedOperationException would probably be helpful.

Would it be possible to fix this? Possibly removing the comments? Idk why the XMPP has comments in it.

It seems to work fine using js’ @xmpp/client - npm (which is why I’m semi-confused).

Yes, removing the non-complying part of the data would fix this.

That is something you have to figure out by looking at the sender’s implementation.

Different XMPP implementations employ a different level of restrictiveness.