fix bug in reworked createPath determination logic

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

Branch: refs/heads/master
Commit: 4d6069a03cf6ff3020abc6faa137515772bd7002
Parents: 824b727
Author: nickhill <nickh...@us.ibm.com>
Authored: Wed Nov 7 08:52:40 2018 -0800
Committer: nickhill <nickh...@us.ibm.com>
Committed: Wed Nov 7 08:57:57 2018 -0800

----------------------------------------------------------------------
 .../curator/framework/recipes/nodes/PersistentNode.java   | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/4d6069a0/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentNode.java
----------------------------------------------------------------------
diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentNode.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentNode.java
index 5fcbc64..80b07e8 100644
--- 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentNode.java
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentNode.java
@@ -452,13 +452,13 @@ public class PersistentNode implements Closeable
             {
                 createPath = existingPath;
             }
-            else
+            else if ( existingPath == null || !mode.isSequential() )
             {
                 createPath = basePath;
-                if ( useProtection && mode.isSequential() )
-                {
-                    createPath += 
existingPath.substring(existingPath.length()-SEQUENTIAL_SUFFIX_DIGITS);
-                }
+            }
+            else
+            {
+                createPath = basePath + 
existingPath.substring(existingPath.length() - SEQUENTIAL_SUFFIX_DIGITS);
             }
 
             CreateModable<ACLBackgroundPathAndBytesable<String>> 
localCreateMethod = createMethod.get();

Reply via email to