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

ASF subversion and git services commented on GEODE-7592:
--------------------------------------------------------

Commit 5ec5dd182ac8f523ee83518b4d727a5527203f5a in geode's branch 
refs/heads/feature/GesterTemp from Dale Emery
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=5ec5dd1 ]

GEODE-7592: Simplify startManager() precondition checks (#4510)

Co-authored-by: Dale Emery <[email protected]>
Co-authored-by: Joris Melchior <[email protected]>

* LGTM complained about a possible NPE in startManager(). There was no
possibility of an NPE, but precondition-checking code was overly
complex, and difficult for LGTM and humans to analyze.

* Adding the tests required injecting several dependencies.

> possible NPE in SystemManagementService
> ---------------------------------------
>
>                 Key: GEODE-7592
>                 URL: https://issues.apache.org/jira/browse/GEODE-7592
>             Project: Geode
>          Issue Type: Improvement
>          Components: management
>            Reporter: Bruce J Schuchardt
>            Assignee: Dale Emery
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> LGTM is reporting a possible NPE in this code:
> {code:java}
> if (federatingManager != null && federatingManager.isRunning()) {
>   throw new AlreadyRunningException(
>       "Manager is already running");
> }
> boolean needsToBeStarted = false;
> if (!isManagerCreated()) {
>   createManager();
>   needsToBeStarted = true;
> } else if (!federatingManager.isRunning()) {
>   needsToBeStarted = true;
> } {code}
>  
> There is a null check in the first "if" statement but no check in the 
> subsequent "else if" statement.



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

Reply via email to