- edited description
InfoDiscovery crashes with NPE after server annouced feature w/o var
I get the following crash when running serviceDiscoveryManager.discoverInformation(server).getResult().getFeatures();
on a buggy Prosody server that sends out empty features.
Exception in thread "main" java.lang.NullPointerException
at java.base/java.util.TreeMap.compare(TreeMap.java:1291)
at java.base/java.util.TreeMap.put(TreeMap.java:536)
at java.base/java.util.TreeSet.add(TreeSet.java:255)
at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.TreeMap$KeySpliterator.forEachRemaining(TreeMap.java:2739)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at rocks.xmpp.extensions.disco.model.info.InfoDiscovery.getFeatures(InfoDiscovery.java:133)
at im.conversations.compliance.xmpp.tests.AbstractDiscoTest.run(AbstractDiscoTest.java:28)
at im.conversations.compliance.xmpp.TestExecutor.executeTestsFor(TestExecutor.java:52)
at im.conversations.compliance.CommandLineLauncher.main(CommandLineLauncher.java:73)
Relevant XML
<iq from="riotcat.org" id="1bea8660-ce42-4de6-8bb1-01697f4fccc1" to="compliancetester@riotcat.org/caas" type="result">
<query xmlns="http://jabber.org/protocol/disco#info">
<identity category="proxy" type="bytestreams" name="SOCKS5 Bytestreams Service"></identity>
<identity category="pubsub" type="pep" name="Prosody"></identity>
<identity category="server" type="im" name="Prosody"></identity>
<identity category="store" type="file" name="HTTP File Upload"></identity>
<feature></feature>
<feature var="http://jabber.org/protocol/bytestreams"></feature>
…
</iq>
Comments (7)
-
reporter -
reporter Got the actual XML from another client.
<feature xmlns="urn:xmpp:archive"><optional xmlns="urn:xmpp:archive"><default xmlns="urn:xmpp:archive"/></optional></feature>
So that feature is of a different namespace and thus should be ignored. So probably not really a buggy prosody.
-
repo owner XEP-136 is really weird in this regard :-/
Should have been done with the default Disco namespace and additional features (optional / default) as with XEP-0060.
I'll have a look into it, thanks for reporting.
-
repo owner - changed status to resolved
-
reporter Hi. Thanks for the fix. Wouldn’t it be better to just ignore feature elements with a namespace other than disco#info instead of parsing it and then deal with the lack of a var attribute? Also; will this be ported to 0.8.1?
-
repo owner An empty <feature/> as in your XML has the same (correct) namespace the other feature elements, it just lacks the var, which eventually caused the NPE.
I will put it into the 0.8 branch for future bugfix releases.
-
repo owner - Log in to comment