You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2018/06/24 14:36:21 UTC

[1/3] curator git commit: CURATOR-448 - Include curator framework state in error messages

Repository: curator
Updated Branches:
  refs/heads/master ba8ade007 -> 129ef5e31


CURATOR-448 - Include curator framework state in error messages


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

Branch: refs/heads/master
Commit: 49485b8fa40c5d5fa95e60ffea3514acf548964b
Parents: 9383aa3
Author: Christopher McTague <cj...@apache.org>
Authored: Mon Jun 11 12:41:58 2018 -0400
Committer: Christopher McTague <cj...@apache.org>
Committed: Mon Jun 11 12:41:58 2018 -0400

----------------------------------------------------------------------
 .../framework/imps/CuratorFrameworkImpl.java    | 44 +++++++++-----------
 1 file changed, 19 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/49485b8f/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index 2bd5c7c..4c66ff6 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -402,75 +402,72 @@ public class CuratorFrameworkImpl implements CuratorFramework
         return (str != null) ? str : "";
     }
 
+    private void checkState()
+    {
+        CuratorFrameworkState state = getState();
+        Preconditions.checkState(state == CuratorFrameworkState.STARTED, "instance state must be %s before calling this method, however its %s", CuratorFrameworkState.STARTED, state);
+    }
+
     @Override
     public CuratorFramework usingNamespace(String newNamespace)
     {
-        Preconditions.checkState(getState() == CuratorFrameworkState.STARTED, "instance must be started before calling this method");
-
+        checkState();
         return namespaceFacadeCache.get(newNamespace);
     }
 
     @Override
     public CreateBuilder create()
     {
-        Preconditions.checkState(getState() == CuratorFrameworkState.STARTED, "instance must be started before calling this method");
-
+        checkState();
         return new CreateBuilderImpl(this);
     }
 
     @Override
     public DeleteBuilder delete()
     {
-        Preconditions.checkState(getState() == CuratorFrameworkState.STARTED, "instance must be started before calling this method");
-
+        checkState();
         return new DeleteBuilderImpl(this);
     }
 
     @Override
     public ExistsBuilder checkExists()
     {
-        Preconditions.checkState(getState() == CuratorFrameworkState.STARTED, "instance must be started before calling this method");
-
+        checkState();
         return new ExistsBuilderImpl(this);
     }
 
     @Override
     public GetDataBuilder getData()
     {
-        Preconditions.checkState(getState() == CuratorFrameworkState.STARTED, "instance must be started before calling this method");
-
+        checkState();
         return new GetDataBuilderImpl(this);
     }
 
     @Override
     public SetDataBuilder setData()
     {
-        Preconditions.checkState(getState() == CuratorFrameworkState.STARTED, "instance must be started before calling this method");
-
+        checkState();
         return new SetDataBuilderImpl(this);
     }
 
     @Override
     public GetChildrenBuilder getChildren()
     {
-        Preconditions.checkState(getState() == CuratorFrameworkState.STARTED, "instance must be started before calling this method");
-
+        checkState();
         return new GetChildrenBuilderImpl(this);
     }
 
     @Override
     public GetACLBuilder getACL()
     {
-        Preconditions.checkState(getState() == CuratorFrameworkState.STARTED, "instance must be started before calling this method");
-
+        checkState();
         return new GetACLBuilderImpl(this);
     }
 
     @Override
     public SetACLBuilder setACL()
     {
-        Preconditions.checkState(getState() == CuratorFrameworkState.STARTED, "instance must be started before calling this method");
-
+        checkState();
         return new SetACLBuilderImpl(this);
     }
 
@@ -491,24 +488,21 @@ public class CuratorFrameworkImpl implements CuratorFramework
     @Override
     public CuratorTransaction inTransaction()
     {
-        Preconditions.checkState(getState() == CuratorFrameworkState.STARTED, "instance must be started before calling this method");
-
+        checkState();
         return new CuratorTransactionImpl(this);
     }
 
     @Override
     public CuratorMultiTransaction transaction()
     {
-        Preconditions.checkState(getState() == CuratorFrameworkState.STARTED, "instance must be started before calling this method");
-
+        checkState();
         return new CuratorMultiTransactionImpl(this);
     }
 
     @Override
     public TransactionOp transactionOp()
     {
-        Preconditions.checkState(getState() == CuratorFrameworkState.STARTED, "instance must be started before calling this method");
-
+        checkState();
         return new TransactionOpImpl(this);
     }
 
@@ -533,7 +527,7 @@ public class CuratorFrameworkImpl implements CuratorFramework
     @Override
     public void sync(String path, Object context)
     {
-        Preconditions.checkState(getState() == CuratorFrameworkState.STARTED, "instance must be started before calling this method");
+        checkState();
 
         path = fixForNamespace(path);
 


[3/3] curator git commit: Closes #267

Posted by ra...@apache.org.
Closes #267

CURATOR-448

changed wording a bit


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

Branch: refs/heads/master
Commit: 129ef5e31170dd5506ef70eaba48667c81a50b98
Parents: d976c50
Author: randgalt <ra...@apache.org>
Authored: Sun Jun 24 09:35:46 2018 -0500
Committer: randgalt <ra...@apache.org>
Committed: Sun Jun 24 09:35:46 2018 -0500

----------------------------------------------------------------------
 .../org/apache/curator/framework/imps/CuratorFrameworkImpl.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/129ef5e3/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index 4c66ff6..07d02e6 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -405,7 +405,7 @@ public class CuratorFrameworkImpl implements CuratorFramework
     private void checkState()
     {
         CuratorFrameworkState state = getState();
-        Preconditions.checkState(state == CuratorFrameworkState.STARTED, "instance state must be %s before calling this method, however its %s", CuratorFrameworkState.STARTED, state);
+        Preconditions.checkState(state == CuratorFrameworkState.STARTED, "Expected state [%s] was [%s]", CuratorFrameworkState.STARTED, state);
     }
 
     @Override


[2/3] curator git commit: Merge branch 'CURATOR-448' of github.com:cjmctague/curator into CURATOR-448

Posted by ra...@apache.org.
Merge branch 'CURATOR-448' of github.com:cjmctague/curator into CURATOR-448


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

Branch: refs/heads/master
Commit: d976c5096fd8e8c36ddb52cf45e1a8fd86aeed19
Parents: ba8ade0 49485b8
Author: randgalt <ra...@apache.org>
Authored: Sun Jun 24 09:34:03 2018 -0500
Committer: randgalt <ra...@apache.org>
Committed: Sun Jun 24 09:34:03 2018 -0500

----------------------------------------------------------------------
 .../framework/imps/CuratorFrameworkImpl.java    | 44 +++++++++-----------
 1 file changed, 19 insertions(+), 25 deletions(-)
----------------------------------------------------------------------