Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-1431

Handling of empty or invalid names

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.17
    • core
    • None

    Description

      The NodeState.getChildNode() says the following about the name argument:

      The name is an opaque string and is not parsed or otherwise interpreted by this method.

      This causes some confusion higher up the stack, for example the following code produces an unexpected result:

      Root root = ...;
      Tree a = root.getTree("/");
      Tree b = root.getTree("/").getChild("");
      assert a.exists() && !b.exists() && a.getPath().equals(b.getPath()); // !
      

      To avoid such confusion, I'd outlaw such potentially troublesome cases like empty names or names containing a forward slash all the way down at the NodeState level. The getChildNode() method could say something like this:

      Names that are empty or ones contain a forward slash are considered invalid and cause an IllegalArgumentException to be thrown.

      Code higher up the stack should probably be adjusted to better handle such edge cases.

      Attachments

        Issue Links

          Activity

            People

              jukkaz Jukka Zitting
              jukkaz Jukka Zitting
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: