Details
Description
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:
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
(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:
/foo /foo/bar /foo/baz
If I have a TreeCache t pointing at /foo then I will get the following results:
t.getCurrentChildren("/sss") => nil t.getCurrentChildren("/foo/sss") => nil t.getCurrentChildren("/foo/barsss") => IllegalArgumentException: Path must start with / character