You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "David Mollitor (Jira)" <ji...@apache.org> on 2019/12/23 17:59:00 UTC

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

David Mollitor created ZOOKEEPER-3662:
-----------------------------------------

             Summary: 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


{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)