From ddf888e6078a17144f3091b3ef2522a3f92b8511 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 19 Apr 2017 12:21:04 +0200 Subject: [PATCH] Do not return null in getLeafNodeProsodyWorkaround and rethrow the original exception. --- .../jivesoftware/smackx/pubsub/PubSubManager.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 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 1f40b3c1e..845a6afac 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 @@ -336,23 +336,19 @@ public final class PubSubManager extends Manager { throw new PubSubException.NotALeafNodeException(id, pubSubService); } - private LeafNode getLeafNodeProsoydWorkaround(final String id) throws NoResponseException, NotConnectedException, InterruptedException, NotALeafNodeException { + private LeafNode getLeafNodeProsoydWorkaround(final String id) throws NoResponseException, NotConnectedException, InterruptedException, NotALeafNodeException, XMPPErrorException { LeafNode leafNode = new LeafNode(this, id); try { // Try to ensure that this is not a collection node by asking for one item form the node. leafNode.getItems(1); } catch (XMPPErrorException e) { Condition condition = e.getXMPPError().getCondition(); - switch (condition) { - // XEP-0060 § 6.5.9.11: Node does not exist - case item_not_found: - return null; - // XEP-0060 § 6.5.9.5: Item retrieval not supported, e.g. because node is a collection node - case feature_not_implemented: + if (condition == Condition.feature_not_implemented) { + // XEP-0060 § 6.5.9.5: Item retrieval not supported, e.g. because node is a collection node throw new PubSubException.NotALeafNodeException(id, pubSubService); - default: - break; } + + throw e; } nodeMap.put(id, leafNode);