CrimpException is not needed
Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/607d51e8 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/607d51e8 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/607d51e8 Branch: refs/heads/CURATOR-3.0 Commit: 607d51e8c5b8a6d041e03dae1f417a7729c14654 Parents: c53f59d Author: randgalt <randg...@apache.org> Authored: Thu Jan 5 13:19:59 2017 -0500 Committer: randgalt <randg...@apache.org> Committed: Thu Jan 5 13:19:59 2017 -0500 ---------------------------------------------------------------------- .../apache/curator/x/crimps/CrimpException.java | 38 -------------------- .../org/apache/curator/x/crimps/TestCrimps.java | 15 +++++++- 2 files changed, 14 insertions(+), 39 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/607d51e8/curator-x-crimps/src/main/java/org/apache/curator/x/crimps/CrimpException.java ---------------------------------------------------------------------- diff --git a/curator-x-crimps/src/main/java/org/apache/curator/x/crimps/CrimpException.java b/curator-x-crimps/src/main/java/org/apache/curator/x/crimps/CrimpException.java deleted file mode 100644 index e36b15e..0000000 --- a/curator-x-crimps/src/main/java/org/apache/curator/x/crimps/CrimpException.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.apache.curator.x.crimps; - -import org.apache.zookeeper.KeeperException; - -public class CrimpException extends RuntimeException -{ - private final KeeperException keeperException; - - public static KeeperException unwrap(Throwable e) - { - while ( e != null ) - { - if ( e instanceof KeeperException ) - { - return (KeeperException)e; - } - e = e.getCause(); - } - return null; - } - - public CrimpException(KeeperException keeperException) - { - super(keeperException); - this.keeperException = keeperException; - } - - public CrimpException(Throwable cause) - { - super(cause); - keeperException = null; - } - - public KeeperException getKeeperException() - { - return keeperException; - } -} http://git-wip-us.apache.org/repos/asf/curator/blob/607d51e8/curator-x-crimps/src/test/java/org/apache/curator/x/crimps/TestCrimps.java ---------------------------------------------------------------------- diff --git a/curator-x-crimps/src/test/java/org/apache/curator/x/crimps/TestCrimps.java b/curator-x-crimps/src/test/java/org/apache/curator/x/crimps/TestCrimps.java index 17c760b..20a02c6 100644 --- a/curator-x-crimps/src/test/java/org/apache/curator/x/crimps/TestCrimps.java +++ b/curator-x-crimps/src/test/java/org/apache/curator/x/crimps/TestCrimps.java @@ -80,7 +80,7 @@ public class TestCrimps extends BaseClassForTests { Assert.fail(code + " expected"); } - KeeperException keeperException = CrimpException.unwrap(e); + KeeperException keeperException = unwrap(e); Assert.assertNotNull(keeperException); Assert.assertEquals(keeperException.code(), code); return null; @@ -106,4 +106,17 @@ public class TestCrimps extends BaseClassForTests throw e; } } + + private static KeeperException unwrap(Throwable e) + { + while ( e != null ) + { + if ( e instanceof KeeperException ) + { + return (KeeperException)e; + } + e = e.getCause(); + } + return null; + } }