lujie created STORM-3048:
----------------------------

             Summary: Fix a Potential NPE
                 Key: STORM-3048
                 URL: https://issues.apache.org/jira/browse/STORM-3048
             Project: Apache Storm
          Issue Type: Bug
            Reporter: lujie


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 , IO exception), 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:

Cluster#getAssignmentById has 20 callers, 18 callers have null checker like 
this:
{code:java}
SchedulerAssignment assignment = cluster.getAssignmentById(td.getId());
if (assignment != null) {
    cpuNeeded -= getCpuUsed(assignment);
     memoryNeeded -= getMemoryUsed(assignment);
}
{code}
the caller have no null checker 
:ConstraintSolverStrategy#checkSpreadSchedulingValid 
ConstraintSolverStrategy#checkConstraintsSatisfied.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to