I am getting exceptions while creating a node to which I will be subscribed to get the notification using smack API. I have written the code I am using:
LeafNode node = null;
try {
try {
LeafNode existingNode = (LeafNode) mgr.getNode(publisherNodeID);
//exists, so delete
mgr.deleteNode(publisherNodeID);
} catch (XMPPException ex1) {
//Here getting Exception that: item-not-found(404)
System.out.println("XMPP Exception: " + ex1.getMessage());
}
node = (LeafNode) mgr.createNode(publisherNodeID);
} catch (XMPPException ex2) {
//And at the same time here getting exception: conflict(409)
System.err.println("Exception while Creating Node: "+ ex2.getMessage());
exit(0);
}
It looks strange to me as firstly I get exception that this node does not exist and then I get exception that The node I am going to create is conflicted(Already Exists).
Note:I am using 3 Jar files -
- smack-3.0.1.jar
- smackx-3.2.1.jar
- smackx-pubsub.0.6.jar