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 "Chetan Mehrotra (JIRA)" <ji...@apache.org> on 2015/04/21 11:48:59 UTC

[jira] [Comment Edited] (OAK-2784) Potential NPEs in BackgroundObserverMBean

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

Chetan Mehrotra edited comment on OAK-2784 at 4/21/15 9:48 AM:
---------------------------------------------------------------

Thanks [~mreutegg]! This was the right fix as {{Nullable}} annotation was giving wrong indication. With this patch Findbugs seems to be happy as well

Also thanks to [~anchela] for taking note of this and following up. For future I would be more careful on how this annotation is left and also keep a check on findbug

{code}
<FileStats path="org/apache/jackrabbit/oak/spi/commit/BackgroundObserver.java" bugCount="0" size="172"/>
{code}

Applied the patch to trunk in http://svn.apache.org/r1675074


was (Author: chetanm):
Thanks [~mreutegg]! This was the right fix as {{Nullable}} annotation was giving wrong indication. With this patch Findbugs seems to be happy as well

{code}
<FileStats path="org/apache/jackrabbit/oak/spi/commit/BackgroundObserver.java" bugCount="0" size="172"/>
{code}

Applied the patch to trunk in http://svn.apache.org/r1675074

> Potential NPEs in BackgroundObserverMBean
> -----------------------------------------
>
>                 Key: OAK-2784
>                 URL: https://issues.apache.org/jira/browse/OAK-2784
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>            Reporter: angela
>            Assignee: Chetan Mehrotra
>              Labels: technical_debt
>             Fix For: 1.3.0
>
>         Attachments: OAK-2784.patch
>
>
> {code}
> @Override
>             public int getLocalEventCount() {
>                 return size(filter(queue, new Predicate<ContentChange>() {
>                     @Override
>                     public boolean apply(@Nullable ContentChange input) {
>                         return input.info != null;
>                     }
>                 }));
>             }
>             @Override
>             public int getExternalEventCount() {
>                 return size(filter(queue, new Predicate<ContentChange>() {
>                     @Override
>                     public boolean apply(@Nullable ContentChange input) {
>                         return input.info == null;
>                     }
>                 }));
>             }
> {code}
> both methods should probably check for {{input}} being null before accessing {{input.info}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)