You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/05/10 13:00:00 UTC
[jira] [Commented] (HELIX-701) Potential ugly NPE
[ https://issues.apache.org/jira/browse/HELIX-701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16470359#comment-16470359 ]
ASF GitHub Bot commented on HELIX-701:
--------------------------------------
Github user lujiefsi commented on the issue:
https://github.com/apache/helix/pull/200
we should combine https://issues.apache.org/jira/browse/HELIX-701 with this pull request,
> Potential ugly NPE
> ------------------
>
> Key: HELIX-701
> URL: https://issues.apache.org/jira/browse/HELIX-701
> Project: Apache Helix
> Issue Type: Bug
> Reporter: brettkk
> Priority: Major
>
> We have developed a static analysis tool [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential NPE. Our analysis shows that some callees may return null in corner case(e.g. node crash , IOException), some of their callers have _!=null_ check but some do not have. In this issue we post a patch which can add !=null based on existed !=null check. For example:
> ZkGrep#parseZkSnapshot:
> {code:java}
> return retFiles;
> } catch (Exception e) {
> LOG.error("fail to parse zkSnapshot: " + lastZkSnapshot, e);
> }
> return null;{code}
> So parseZkSnapshot will return null while IOException happens. but its caller ZkGrep#processCommandLineArgs have no null checker:
> {code:java}
> File[] lastZkSnapshot = parseZkSnapshot(zkDataDirs[1], byTime);
> // lastZkSnapshot[1] is the parsed last snapshot by byTime
> grepZkSnapshot(lastZkSnapshot[1], patterns);
> {code}
> We should terminate the process while lastZkSnapshot == null
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)