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

rafiya sirin edited comment on OAK-8948 at 3/13/20, 9:02 AM:
-------------------------------------------------------------

[~mreutegg]  ,the issue that i face is with excludePaths, in if 
(exclude.equals(include) || isAncestor(exclude, include)) { 
  

'exclude' is null here. 

the set excludePaths is constructed from getOakPath [ 
[https://github.com/apache/jackrabbit-oak/blob/trunk/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/namepath/PathMapper.java#L43]
|https://github.com/apache/jackrabbit-oak/blob/trunk/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/namepath/PathMapper.java#L43]|

this method can return null if oakPath doesn't exist, hence it makes sense to 
add the null check.


was (Author: sirin):
the issue that i face is with excludePaths, in if (exclude.equals(include) || 
isAncestor(exclude, include)) { 
 

'exclude' is null here. 

the set excludePaths is constructed from getOakPath [ 
[https://github.com/apache/jackrabbit-oak/blob/trunk/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/namepath/PathMapper.java#L43]
|https://github.com/apache/jackrabbit-oak/blob/trunk/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/namepath/PathMapper.java#L43]

this method can return null if oakPath doesn't exist, hence it makes sense to 
add the null check.

> PathUtils. unifyInExcludes throws NPE when 'exclude' is null
> ------------------------------------------------------------
>
>                 Key: OAK-8948
>                 URL: https://issues.apache.org/jira/browse/OAK-8948
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: jackrabbit-api
>    Affects Versions: 1.8.17, 1.8.20
>            Reporter: rafiya sirin
>            Assignee: Marcel Reutegger
>            Priority: Major
>              Labels: Observation
>             Fix For: 1.8.21
>
>         Attachments: Screen Shot 2020-03-13 at 2.25.07 PM.png, stacktrace.txt
>
>
> While registering a resource change listener, we encountered the following 
> exception : 
>  
> {code:java}
> 05.03.2020 23:39:00.728 *ERROR* [FelixDispatchQueue] 
> org.apache.sling.resourceresolver FrameworkEvent ERROR 
> (java.lang.NullPointerException)
> java.lang.NullPointerException: null
> at 
> org.apache.jackrabbit.oak.commons.PathUtils.unifyInExcludes(PathUtils.java:501)
>  [org.apache.jackrabbit.oak-commons:1.8.17]
> at 
> org.apache.jackrabbit.oak.jcr.observation.ObservationManagerImpl.addEventListener(ObservationManagerImpl.java:240)
>  [org.apache.jackrabbit.oak-jcr:1.8.17]
> at 
> org.apache.sling.jcr.resource.internal.JcrListenerBaseConfig.register(JcrListenerBaseConfig.java:136)
>  [org.apache.sling.jcr.resource:3.0.16.1]
> {code}
>  
> On further debugging, we found that issues lies in this snippet : 
> {code:java}
> if (exclude.equals(include) || isAncestor(exclude, include)) {
>  includesRemoved.add(include);{code}
> 'exclude' can be null if the getOakPath() method returns a null. This NPE 
> causes listeners(ResourceChangeListener in our case) to fail at registration.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to