STORM-1750: Replace manual check for exception cause with try-cause

Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/a910e29a
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/a910e29a
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/a910e29a

Branch: refs/heads/1.0.x-branch
Commit: a910e29a2616e99b6e6d2ff132d3971428a11a31
Parents: 6e4bdbc
Author: Stig Rohde Døssing <[email protected]>
Authored: Thu May 5 11:10:38 2016 +0200
Committer: Stig Rohde Døssing <[email protected]>
Committed: Thu May 5 11:10:38 2016 +0200

----------------------------------------------------------------------
 .../apache/storm/cluster_state/zookeeper_state_factory.clj   | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/a910e29a/storm-core/src/clj/org/apache/storm/cluster_state/zookeeper_state_factory.clj
----------------------------------------------------------------------
diff --git 
a/storm-core/src/clj/org/apache/storm/cluster_state/zookeeper_state_factory.clj 
b/storm-core/src/clj/org/apache/storm/cluster_state/zookeeper_state_factory.clj
index 06557d4..061c9e8 100644
--- 
a/storm-core/src/clj/org/apache/storm/cluster_state/zookeeper_state_factory.clj
+++ 
b/storm-core/src/clj/org/apache/storm/cluster_state/zookeeper_state_factory.clj
@@ -92,12 +92,10 @@
          (zk/set-data zk-writer path data)
          (do
            (zk/mkdirs zk-writer (parent-path path) acls)
-           (try
+           (try-cause
              (zk/create-node zk-writer path data :persistent acls)
-             (catch RuntimeException e
-               (if (instance? KeeperException$NodeExistsException (.getCause 
e))
-                 (zk/set-data zk-writer path data)
-                 (throw e)))))))
+             (catch KeeperException$NodeExistsException e
+               (zk/set-data zk-writer path data))))))
 
      (set-worker-hb
        [this path data acls]

Reply via email to