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 2017/07/16 19:45:05 UTC

curator git commit: GetDataBuilderImpl() wasn't handling storingStatIn for async because the old DSL didn't support it

Repository: curator
Updated Branches:
  refs/heads/CURATOR-424 [created] c6f7aeb39


GetDataBuilderImpl() wasn't handling storingStatIn for async because the old DSL didn't support it


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

Branch: refs/heads/CURATOR-424
Commit: c6f7aeb39957158fad0207614583f867729e7770
Parents: 123f2ec
Author: randgalt <ra...@apache.org>
Authored: Sun Jul 16 14:44:56 2017 -0500
Committer: randgalt <ra...@apache.org>
Committed: Sun Jul 16 14:44:56 2017 -0500

----------------------------------------------------------------------
 .../apache/curator/framework/imps/GetDataBuilderImpl.java |  5 +++++
 .../org/apache/curator/x/async/TestBasicOperations.java   | 10 ++++++++++
 2 files changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/c6f7aeb3/curator-framework/src/main/java/org/apache/curator/framework/imps/GetDataBuilderImpl.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/GetDataBuilderImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/GetDataBuilderImpl.java
index 95af6dd..2319b9d 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/GetDataBuilderImpl.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/GetDataBuilderImpl.java
@@ -26,6 +26,7 @@ import org.apache.zookeeper.AsyncCallback;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.Watcher;
 import org.apache.zookeeper.data.Stat;
+import org.apache.zookeeper.server.DataTree;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import java.util.concurrent.Callable;
@@ -250,6 +251,10 @@ public class GetDataBuilderImpl implements GetDataBuilder, BackgroundOperation<S
                 {
                     watching.commitWatcher(rc, false);
                     trace.setReturnCode(rc).setResponseBytesLength(data).setPath(path).setWithWatcher(watching.hasWatcher()).setStat(stat).commit();
+                    if ( (responseStat != null) && (stat != null) )
+                    {
+                        DataTree.copyStat(stat, responseStat);
+                    }
                     if ( decompress && (data != null) )
                     {
                         try

http://git-wip-us.apache.org/repos/asf/curator/blob/c6f7aeb3/curator-x-async/src/test/java/org/apache/curator/x/async/TestBasicOperations.java
----------------------------------------------------------------------
diff --git a/curator-x-async/src/test/java/org/apache/curator/x/async/TestBasicOperations.java b/curator-x-async/src/test/java/org/apache/curator/x/async/TestBasicOperations.java
index 3e980ec..f814146 100644
--- a/curator-x-async/src/test/java/org/apache/curator/x/async/TestBasicOperations.java
+++ b/curator-x-async/src/test/java/org/apache/curator/x/async/TestBasicOperations.java
@@ -189,4 +189,14 @@ public class TestBasicOperations extends CompletableBaseClassForTests
             Assert.assertEquals(v.getCode(), KeeperException.Code.CONNECTIONLOSS);
         });
     }
+
+    @Test
+    public void testGetDataWithStat()
+    {
+        complete(client.create().forPath("/test", "hey".getBytes()));
+
+        Stat stat = new Stat();
+        complete(client.getData().storingStatIn(stat).forPath("/test"));
+        Assert.assertEquals(stat.getDataLength(), "hey".length());
+    }
 }