Reputation: 641
I'm using converse.js
and trying to work with privacy lists. I'm trying to send this IQ:
<body rid="2993056535" xmlns="http://jabber.org/protocol/httpbind" sid="578oe88nm1">
<iq from="alex3@ofb2" type="set" id="active1" xmlns="jabber:client">
<query xmlns="jabber:iq:privacy"/>
</iq>
</body>
This is what server returns me:
<body xmlns="http://jabber.org/protocol/httpbind" ack="2993056535">
<iq xmlns="jabber:client" type="error" id="active1" to="alex3@ofb2/converse.js-90734653">
<query xmlns="jabber:iq:privacy"/>
<error code="500" type="wait">
<internal-server-error xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
</body>
In the server logs I see this exception:
2016.02.19 12:49:00 org.jivesoftware.openfire.handler.IQHandler - Internal server error
java.lang.NullPointerException
at org.jivesoftware.openfire.handler.IQPrivacyHandler.handleIQ(IQPrivacyHandler.java:120)
at org.jivesoftware.openfire.handler.IQHandler.process(IQHandler.java:66)
at org.jivesoftware.openfire.IQRouter.handle(IQRouter.java:372)
at org.jivesoftware.openfire.IQRouter.route(IQRouter.java:115)
at org.jivesoftware.openfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:78)
at org.jivesoftware.openfire.SessionPacketRouter.route(SessionPacketRouter.java:108)
at org.jivesoftware.openfire.SessionPacketRouter.route(SessionPacketRouter.java:67)
at org.jivesoftware.openfire.http.HttpSession.sendPendingPackets(HttpSession.java:639)
at org.jivesoftware.openfire.http.HttpSession$HttpPacketSender.run(HttpSession.java:1270)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
What's wrong?
Upvotes: 0
Views: 868
Reputation: 41648
The stacktrace points to these lines:
// Privacy list handling (create/edit/delete)
Element list = child.element("list");
String listName = list.attributeValue("name");
That is, it looks for a child element <list>
, and crashes when it can't find it.
So why does it look for that? It turns out that this is the branch it takes if the IQ has type set
(and neither a <default>
nor <active>
child element). However, as described in XEP-0016, to get the names of existing privacy lists you need to send an IQ with type get
instead. Your request should look like this instead:
<iq from='[email protected]/orchard' type='get' id='getlist1'>
<query xmlns='jabber:iq:privacy'/>
</iq>
Upvotes: 1