powered by Jive Software

URISyntaxException: Illegal character in opaque part in ReferenceProvider

While I’m not actively making use of ReferenceProvider (Smack 4.3.5-snapshot), it prevents some messages from being parsed and displayed:

java.net.URISyntaxException: Illegal character in opaque part at index 39: xmpp:prosody@conference.prosody.im/Link Mauve
   at java.net.URI$Parser.fail(URI.java:2856)
   at java.net.URI$Parser.checkChars(URI.java:3029)
   at java.net.URI$Parser.parse(URI.java:3066)
   at java.net.URI.<init>(URI.java:590)
   at org.jivesoftware.smackx.reference.provider.ReferenceProvider.parse(ReferenceProvider.java:41)
   at org.jivesoftware.smackx.reference.provider.ReferenceProvider.parse(ReferenceProvider.java:29)
   at org.jivesoftware.smack.provider.Provider.parse(Provider.java:43)
   at org.jivesoftware.smack.util.PacketParserUtils.parseExtensionElement(PacketParserUtils.java:918)
   at org.jivesoftware.smack.util.PacketParserUtils.addExtensionElement(PacketParserUtils.java:989)
   at org.jivesoftware.smack.util.PacketParserUtils.parseMessage(PacketParserUtils.java:264)
   at org.jivesoftware.smack.util.PacketParserUtils.parseStanza(PacketParserUtils.java:155)
   at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMPPConnection.java:1084)
   at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$1300(XMPPTCPConnection.java:155)
   at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1146)
   at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$1000(XMPPTCPConnection.java:1094)
   at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:1114)
   at java.lang.Thread.run(Thread.java:761)

The causing message is apparently:

<message to="..." id="02428aca-9997-4679-a1c5-8fcc8a1973ab" from="prosody@conference.prosody.im/bent3n" type="groupchat">
  <body>rumblefish Nice name btw LOL Link Mauve Zash Allo I've upgraded to v18.01 LTS and now using prosody 0.10. Can anyone please help me on how to use a javascript client library(strophe, stanza, @xmpp/client) or if you can point me to tutorials (bnyann@u.rochester.edu) I'd really appreciate it as I'm an utter noob</body>
  <active xmlns="http://jabber.org/protocol/chatstates"/>
  <reference xmlns="urn:xmpp:reference:0" uri="xmpp:prosody@conference.prosody.im/rumblefish" end="10" begin="0" type="mention"/>
  <reference xmlns="urn:xmpp:reference:0" uri="xmpp:prosody@conference.prosody.im/Link Mauve" end="39" begin="29" type="mention"/>
  <reference xmlns="urn:xmpp:reference:0" uri="xmpp:prosody@conference.prosody.im/Zash" end="44" begin="40" type="mention"/>
  <reference xmlns="urn:xmpp:reference:0" uri="xmpp:prosody@conference.prosody.im/Allo" end="49" begin="45" type="mention"/>
  <replace xmlns="urn:xmpp:message-correct:0" id="26e3550d-da06-4ef6-8de2-36633a0a7454"/>
  <origin-id xmlns="urn:xmpp:sid:0" id="2fd26e05-2168-49c4-9eb5-25de8951c830"/>
  <stanza-id xmlns="urn:xmpp:sid:0" id="G7sJPkoLeh-Vn3WI" by="prosody@conference.prosody.im"/>
  <delay xmlns="urn:xmpp:delay" from="prosody@conference.prosody.im" stamp="2019-10-23T10:02:25Z"/>
  <x xmlns="jabber:x:delay" from="prosody@conference.prosody.im" stamp="20191023T10:02:25"/>
</message>

I’m not sure if the passed URI is actually invalid or not, but this is another point where a single broken extension element makes the whole stanza unparseable.

The URI is invalid. Please inform the software maintainer of the software which the generating entity uses about that bug.

Yep. And again, I hope that Smack will be able at one point to allow detailed control over what happens in that case. This would also include just dropping the faulty extension element, even though I believe this to be dangerous. We are not there yet, but potentially soon™.