From 10927577ad15c27bc8c8a90bad8661cc6e009868 Mon Sep 17 00:00:00 2001 From: vanitasvitae Date: Wed, 19 Apr 2017 11:34:47 +0200 Subject: [PATCH] Fix getOrCreateLeafNode for prosody --- .../smackx/pubsub/PubSubManager.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java index 3fa1832c2..02578077b 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java @@ -289,16 +289,16 @@ public final class PubSubManager extends Manager { throw e2; } } + if (e1.getXMPPError().getCondition() == Condition.service_unavailable) { + // This could be caused by Prosody bug #805 (see https://prosody.im/issues/issue/805). Prosody does not + // answer to disco#info requests on the node ID, which makes it undecidable if a node is a leaf or + // collection node. + LOGGER.warning("The PubSub service " + pubSubService + + " threw an DiscoInfoNodeAssertionError, trying workaround for Prosody bug #805 (https://prosody.im/issues/issue/805)"); + return getOrCreateLeafNodeProsodyWorkaround(id); + } throw e1; } - catch (PubSubAssertionError.DiscoInfoNodeAssertionError e) { - // This could be caused by Prosody bug #805 (see https://prosody.im/issues/issue/805). Prosody does not - // answer to disco#info requests on the node ID, which makes it undecidable if a node is a leaf or - // collection node. - LOGGER.warning("The PubSub service " + pubSubService - + " threw an DiscoInfoNodeAssertionError, trying workaround for Prosody bug #805 (https://prosody.im/issues/issue/805)"); - return getOrCreateLeafNodeProsodyWorkaround(id); - } } private LeafNode getOrCreateLeafNodeProsodyWorkaround(final String id)