STORM-1750: Replace manual exception cause check with Utils.exceptionCauseIsInstanceOf
Project: http://git-wip-us.apache.org/repos/asf/storm/repo Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/2bebca52 Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/2bebca52 Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/2bebca52 Branch: refs/heads/master Commit: 2bebca52a56f98fa423c518eae6af50c00c9b098 Parents: b267c29 Author: Stig Rohde Døssing <[email protected]> Authored: Thu May 5 10:57:47 2016 +0200 Committer: Stig Rohde Døssing <[email protected]> Committed: Thu May 5 10:57:47 2016 +0200 ---------------------------------------------------------------------- storm-core/src/jvm/org/apache/storm/cluster/ZKStateStorage.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/storm/blob/2bebca52/storm-core/src/jvm/org/apache/storm/cluster/ZKStateStorage.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/org/apache/storm/cluster/ZKStateStorage.java b/storm-core/src/jvm/org/apache/storm/cluster/ZKStateStorage.java index e35d30b..87e7dfc 100644 --- a/storm-core/src/jvm/org/apache/storm/cluster/ZKStateStorage.java +++ b/storm-core/src/jvm/org/apache/storm/cluster/ZKStateStorage.java @@ -28,7 +28,6 @@ import org.apache.storm.utils.Utils; import org.apache.storm.zookeeper.Zookeeper; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException; -import org.apache.zookeeper.KeeperException.NodeExistsException; import org.apache.zookeeper.Watcher; import org.apache.zookeeper.data.ACL; import org.slf4j.Logger; @@ -193,7 +192,7 @@ public class ZKStateStorage implements IStateStorage { try { Zookeeper.createNode(zkWriter, path, data, CreateMode.PERSISTENT, acls); } catch (RuntimeException e) { - if (e.getCause() instanceof NodeExistsException) { + if (Utils.exceptionCauseIsInstanceOf(KeeperException.NodeExistsException.class, e)) { Zookeeper.setData(zkWriter, path, data); } else { throw e;
