1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-29 17:52:06 +01:00

Do not return null in getLeafNodeProsodyWorkaround

and rethrow the original exception.
This commit is contained in:
Florian Schmaus 2017-04-19 12:21:04 +02:00
parent bfab3ec578
commit ddf888e607

View file

@ -336,23 +336,19 @@ public final class PubSubManager extends Manager {
throw new PubSubException.NotALeafNodeException(id, pubSubService); 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); LeafNode leafNode = new LeafNode(this, id);
try { try {
// Try to ensure that this is not a collection node by asking for one item form the node. // Try to ensure that this is not a collection node by asking for one item form the node.
leafNode.getItems(1); leafNode.getItems(1);
} catch (XMPPErrorException e) { } catch (XMPPErrorException e) {
Condition condition = e.getXMPPError().getCondition(); Condition condition = e.getXMPPError().getCondition();
switch (condition) { if (condition == Condition.feature_not_implemented) {
// 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 // XEP-0060 § 6.5.9.5: Item retrieval not supported, e.g. because node is a collection node
case feature_not_implemented:
throw new PubSubException.NotALeafNodeException(id, pubSubService); throw new PubSubException.NotALeafNodeException(id, pubSubService);
default:
break;
} }
throw e;
} }
nodeMap.put(id, leafNode); nodeMap.put(id, leafNode);