Uploaded image for project: 'Apache Curator'
  1. Apache Curator
  2. CURATOR-236

TreeCache throws IllegalArgumentException when node is a substring of the requested path

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.8.0
    • 2.9.0
    • Recipes
    • None
    • JDK 1.7.0_71; OSX Yosemite;

    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
      

      Attachments

        Activity

          People

            dragonsinth Scott Blum
            japher Joe Littlejohn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: