You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@zookeeper.apache.org by "Norbert Kalmár (Jira)" <ji...@apache.org> on 2020/11/03 16:04:00 UTC

[jira] [Resolved] (ZOOKEEPER-3662) Remove NPE Possibility in Follower Class

     [ https://issues.apache.org/jira/browse/ZOOKEEPER-3662?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Norbert Kalmár resolved ZOOKEEPER-3662.
---------------------------------------
    Fix Version/s: 3.7.0
       Resolution: Fixed

> Remove NPE Possibility in Follower Class
> ----------------------------------------
>
>                 Key: ZOOKEEPER-3662
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3662
>             Project: ZooKeeper
>          Issue Type: Improvement
>            Reporter: David Mollitor
>            Assignee: David Mollitor
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 3.7.0
>
>          Time Spent: 3.5h
>  Remaining Estimate: 0h
>
> {code:java|title=Follower.java}
>     public long getZxid() {
>         try {
>             synchronized (fzk) {
>                 return fzk.getZxid();
>             }
>         } catch (NullPointerException e) {
>             LOG.warn("error getting zxid", e);
>         }
>         return -1;
>     }
> {code}
> I traced the code and there is no reason to catch a NPE here.  Add additional restrictions to make sure NPE will never happen.



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