[
https://issues.apache.org/jira/browse/OAK-8218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16815192#comment-16815192
]
angela edited comment on OAK-8218 at 4/11/19 8:29 AM:
------------------------------------------------------
[~mreutegg], fine with me. in the meantime i spotted one usage in _oak-search_
that might actually return {{null}} for {{getTypes}}.... but that one could be
improved by actually creating a {{Root}} from the root-state and then simply
calling {{Root.getTree}}.... see attached patch OAK-8218-IndexDefinition.patch
was (Author: anchela):
[~mreutegg], fine with me. in the meantime i spotted one usage in _oak-search_
that might actually return {{null}} for {{getTypes}}.... but that one could be
improved by actually creating a {{Root}} from the root-state and then simply
calling {{Root.getTree}}.... see attached patch.
> ReadOnlyNodeTypeManager.isNodeType prone to NPE
> -----------------------------------------------
>
> Key: OAK-8218
> URL: https://issues.apache.org/jira/browse/OAK-8218
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: core
> Reporter: angela
> Assignee: Marcel Reutegger
> Priority: Major
> Attachments: OAK-8218-IndexDefinition.patch, OAK-8218.patch
>
>
> 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.
> [~reschke], [~mreutegg], since you have been touching the
> {{ReadOnlyNodeTypeManager}} in the past, do you have any preference?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)