[ 
https://issues.apache.org/jira/browse/OAK-8212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16893471#comment-16893471
 ] 

Julian Reschke edited comment on OAK-8212 at 7/2/25 3:50 PM:
-------------------------------------------------------------

trunk: (1.14.0) 
[a65b925e66|https://github.com/apache/jackrabbit-oak/commit/a65b925e661e0cbf22e2844f85e68c6b6aaeae55]
1.22: (1.14.0) 
[a65b925e66|https://github.com/apache/jackrabbit-oak/commit/a65b925e661e0cbf22e2844f85e68c6b6aaeae55]

...in retired branches:
1.10: (1.10.4) 
[07446e80ea|https://github.com/apache/jackrabbit-oak/commit/07446e80eade2144d4a6efaa72e0ca3313876e25]
1.8: (1.8.16) 
[96446e635d|https://github.com/apache/jackrabbit-oak/commit/96446e635d6254c0d530a399ca3252c068dac001]


was (Author: reschke):
trunk: (1.14.0) [r1857242|http://svn.apache.org/r1857242]
1.10: (1.10.4) [r1863781|http://svn.apache.org/r1863781]
1.8: [r1865296|http://svn.apache.org/r1865296]


> ImporterImpl.importProperties prone to NPE
> ------------------------------------------
>
>                 Key: OAK-8212
>                 URL: https://issues.apache.org/jira/browse/OAK-8212
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: jcr
>            Reporter: Angela Schreiber
>            Assignee: Angela Schreiber
>            Priority: Major
>             Fix For: 1.14.0, 1.10.4, 1.8.16
>
>
> the {{ImportImpl}} code at line 275 is prone to NPE because 
> {{EffectiveNodeType.getPropertyDefinition(String, int, boolean)}} may return 
> {{null}} (in contrast to the second variant that throws 
> {{ConstraintViolationException}} if no matching definition is found.
> the code looks as follows:
> {code}
> EffectiveNodeType ent = effectiveNodeTypeProvider.getEffectiveNodeType(tree);
> PropertyDefinition def = ent.getPropertyDefinition(pi.getName(), 
> pi.getType(), pi.isUnknownMultiple());
> if (def.isProtected()) {
>     ...
> }
> {code}
> proposed fix (adding a check for null):
> {code}
> EffectiveNodeType ent = effectiveNodeTypeProvider.getEffectiveNodeType(tree);
> PropertyDefinition def = ent.getPropertyDefinition(pi.getName(), 
> pi.getType(), pi.isUnknownMultiple());
> if (def == null) {
>        throw new ConstraintViolationException("No matching property 
> definition found for " + pi.getName());
> }
> if (def.isProtected()) {
>     ...
> }
> {code}
> i spotted the issue while writing an import test for OAK-8190 with property 
> type mismatch.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to