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

ReadOnlyNodeTypeManager.isNodeType prone to NPE

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      in the light of OAK-8216 and OAK-8212 i spotted a potential NPE in all variants of ReadOnlyNodeTypeManager.isNodeType: these methods pass the value of getTypes(), which might return null, to isa(Tree types, String typeName, String superName), which does not check for the types parameter to be null.

      i checked most extensions of ReadOnlyNodeTypeManager and non of them ever returns null because the usually just retrieve the tree at the node-types paths, which may or may not exist but Root.getTree never returns null (maybe it did in the early days of oak). anyway, this leaves me with the feeling that the 'nullable' annotation with ReadOnlyNodeTypeManager.isNodeType is wrong with and should be 'notnull' instead. this would allow to annotate isa(Tree types, String typeName, String superName)
      with notnull and avoid the extra check for null.... but at the end i would also be find with just adding a check for null in the isa method and mark the types param as nullable.

      Julian Reschke, Marcel Reutegger, since you have been touching the ReadOnlyNodeTypeManager in the past, do you have any preference?

      Attachments

        1. OAK-8218.patch
          1.0 kB
          Angela Schreiber
        2. OAK-8218-IndexDefinition.patch
          2 kB
          Angela Schreiber
        3. OAK-8218-2.patch
          11 kB
          Marcel Reutegger

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            mreutegg Marcel Reutegger
            angela Angela Schreiber
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment