Joe Littlejohn created CURATOR-236:
--------------------------------------

             Summary: TreeCache throws IllegalArgumentException when node is a 
substring of the requested path
                 Key: CURATOR-236
                 URL: https://issues.apache.org/jira/browse/CURATOR-236
             Project: Apache Curator
          Issue Type: Bug
          Components: Recipes
    Affects Versions: 2.8.0
         Environment: JDK 1.7.0_71; OSX Yosemite;
            Reporter: Joe Littlejohn
            Priority: Minor


The javadocs for the new TreeCache state that {{getCurrentChildren}} will 
return {{null}} when the given path is not found in the cache. This seems to be 
the case for most paths, however if the given path contains an existing node as 
a substring, an exception is thrown:

{code}
Unhandled java.lang.IllegalArgumentException
   Path must start with / character

                PathUtils.java:   54  
org.apache.curator.utils.PathUtils/validatePath
                  ZKPaths.java:  149  org.apache.curator.utils.ZKPaths/split
                TreeCache.java:  597  
org.apache.curator.framework.recipes.cache.TreeCache/find
                TreeCache.java:  625  
org.apache.curator.framework.recipes.cache.TreeCache/getCurrentChildren
                           nil:   -1  
sun.reflect.GeneratedMethodAccessor13/invoke
DelegatingMethodAccessorImpl.java:   43  
sun.reflect.DelegatingMethodAccessorImpl/invoke
                   Method.java:  606  java.lang.reflect.Method/invoke
                Reflector.java:   93  
clojure.lang.Reflector/invokeMatchingMethod
                Reflector.java:   28  
clojure.lang.Reflector/invokeInstanceMethod
                          REPL:    1  healthy.zookeeper/eval20736
{code}

(please ignore the strangely formatted exception, I'm running a Clojure repl in 
Emacs)

So, lets imagine that I have the following nodes in zookeeper:

{code}
/foo
/foo/bar
/foo/baz
{code}

If I have a TreeCache {{t}} pointing at {{/foo}} then I will get the following 
results:
{code}
t.getCurrentChildren("/sss") => nil
t.getCurrentChildren("/foo/sss") => nil
t.getCurrentChildren("/foo/barsss") => IllegalArgumentException: Path must 
start with / character
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to