You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Vikas Saurabh (JIRA)" <ji...@apache.org> on 2019/01/10 21:08:00 UTC

[jira] [Commented] (OAK-7983) LazyLuceneIndexNode#getIndexNode can cause NPE

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

Vikas Saurabh commented on OAK-7983:
------------------------------------

I was wondering why this should show up now after lazy loading and I understand now how it was being avoided earlier. The problem is that {{acquireIndexNode}} could still return {{null}} {{IndexNode}} but would get checked right away during acquire. But with {{LazyLuceneIndexNode}} implementation of {{IndexNode}} the caller always gets an object which is kind of is a promise to caller that use me as a proxy for real thing. But later the caller would call other methods and the reality can hit with an NPE.

To me, a potential way could be to return {{LazyLuceneIndexNode}} only if we have done at least some sanity checks (the index isn't already marked bad). But, even then we'd left with the case of say first acquire of a bad index - earlier it would have failed right away and gets handled (e.g. in {{FulltextIndex#getPlans()}} ) but now the planner (for example) would get an object and would fail later.

Of course, the other alternative is to statically follow callers and subsequent method calls and check for null-ish values.

> LazyLuceneIndexNode#getIndexNode can cause NPE
> ----------------------------------------------
>
>                 Key: OAK-7983
>                 URL: https://issues.apache.org/jira/browse/OAK-7983
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: lucene
>    Affects Versions: 1.9.13
>            Reporter: Tommaso Teofili
>            Priority: Major
>
> Changes for OAK-7947 have introduced a LazyLuceneIndexNode. Its methods call for IndexTracker#findIndexNode and #acquireIndexNode which can return `null`, however no proper checks are performed. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)