PubSub: getNodeConfiguration failed

Hello,

I use Smack to browse a PubSub node hierarchy in a client and I have a problem with the following code:

package test; import java.util.Iterator; import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.ServiceDiscoveryManager;
import org.jivesoftware.smackx.packet.DiscoverItems;
import org.jivesoftware.smackx.pubsub.CollectionNode;
import org.jivesoftware.smackx.pubsub.ConfigureForm;
import org.jivesoftware.smackx.pubsub.Node;
import org.jivesoftware.smackx.pubsub.PubSubManager; public class DebugSmack {     /**
     * @param args
     * @throws XMPPException
     */
    public static void main(String[] args) throws XMPPException {         // do connection
        m_connection = null;
        doConnect();         // on parcourt les noeuds à partir du noeud root, normalement
        browseCollection("", 0);         doDisconnect();
        System.err.println("Disconnected");
    }     private static void doConnect() throws XMPPException {         doDisconnect();         ConnectionConfiguration config = new ConnectionConfiguration(SERVICE);
        config.setRosterLoadedAtLogin(false);
        m_connection = new XMPPConnection(config);
        m_connection.connect();
        m_connection.login("subscriber", "sub");         // creation of the Service DiscoveryManager for this connection
        new ServiceDiscoveryManager(m_connection);         // creation of the PubSubManager
        m_pubSubMng = new PubSubManager(m_connection, PUBSUB_SERVICE);
    }     private static void doDisconnect() {
        if (m_connection != null && m_connection.isConnected())
            m_connection.disconnect();
        m_connection = null;
    }     private static void browseCollection(String nodeId, int level)
            throws XMPPException {         DiscoverItems nodes = m_pubSubMng.discoverNodes(nodeId);
        Iterator<DiscoverItems.Item> it = nodes.getItems();
        while (it.hasNext()) {
            Node n = m_pubSubMng.getNode(it.next().getNode());
            for (int i = 0; i < level; i++)
                System.out.print("--");
            System.out.print("->");
            System.out.println(n);             ConfigureForm conf = n.getNodeConfiguration();
            System.out.println(conf.toString());             if (n instanceof CollectionNode) {
                // n is a collection Node
                browseCollection(n.getId(), level + 1);
                continue;
            }
        }
    }     private final static String SERVICE = "monitor.crowd.lan";
    private final static String PUBSUB_SERVICE = "pubsub.monitor.crowd.lan";     private static XMPPConnection m_connection;
    private static PubSubManager m_pubSubMng;
}

Sorry for this big block of code, but I prefere post a complete example.

My problem is at the line n.getNodeConfiguration(); , it raises an exception:

java.util.NoSuchElementException
    at java.util.AbstractList$Itr.next(Unknown Source)
    at org.jivesoftware.smackx.pubsub.provider.FormNodeProvider.createReturnExtension(FormNodeProvider.java:37)
    at org.jivesoftware.smackx.provider.EmbeddedExtensionProvider.parseExtension(EmbeddedExtensionProvider.java:105)
    at org.jivesoftware.smack.util.PacketParserUtils.parsePacketExtension(PacketParserUtils.java:730)
    at org.jivesoftware.smackx.pubsub.provider.PubSubProvider.parseIQ(PubSubProvider.java:45)
    at org.jivesoftware.smack.util.PacketParserUtils.parseIQ(PacketParserUtils.java:268)
    at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:229)
    at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)
    at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)
Exception in thread "main" No response from server.:     at org.jivesoftware.smackx.pubsub.packet.SyncPacketSend.getReply(SyncPacketSend.java:50)
    at org.jivesoftware.smackx.pubsub.packet.SyncPacketSend.getReply(SyncPacketSend.java:61)
    at org.jivesoftware.smackx.pubsub.PubSubManager.sendPubsubPacket(PubSubManager.java:312)
    at org.jivesoftware.smackx.pubsub.Node.sendPubsubPacket(Node.java:349)
    at org.jivesoftware.smackx.pubsub.Node.getNodeConfiguration(Node.java:86)
    at test.DebugSmack.browseCollection(DebugSmack.java:73)
    at test.DebugSmack.main(DebugSmack.java:32)

The error appears when I make the request with a standard user, not the owner of the node. When I make the request with the owner of the node or with the admin user, it works well. I would like to know if it is normal that I get this exception, and how to do for catching it ? It is raised from a thread created by the lib I think.

My first aim is to get the Title of the nodes, not only the ID.

My configuration:

  • Smack from SVN

  • Openfire from SVN

Has anybody got any idea ?

Thanks in advance,

Paulo

Looks like a bug, I logged it as SMACK-318.