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

lujie updated STORM-3051:
-------------------------
    Description: 
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. 

*Bug:*

callee CgroupCenter#getSubSystems return null when meet exception:
{code:java}
} catch (Exception e) {
LOG.error("Get subSystems error {}", e);
}
return null;
{code}
but its caller use it without check:
{code:java}
public boolean isSubSystemEnabled(SubSystemType subSystemType) {
  Set<SubSystem> subSystems = this.getSubSystems();
  for (SubSystem subSystem : subSystems) {
     if (subSystem.getType() == subSystemType) {
     return true;
  }
  }
  return false;
}{code}

callee RAS_Node#getUsedSlots and caller RAS_Node#totalSlotsUsed have same 
problem

  was:
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. 

*Bug:*

callee CgroupCenter#getSubSystems return null when meet exception:
{code:java}
} catch (Exception e) {
LOG.error("Get subSystems error {}", e);
}
return null;
{code}
but its caller use it without check:
{code:java}
public boolean isSubSystemEnabled(SubSystemType subSystemType) {
  Set<SubSystem> subSystems = this.getSubSystems();
  for (SubSystem subSystem : subSystems) {
     if (subSystem.getType() == subSystemType) {
     return true;
  }
  }
  return false;
}
{code}


> two Potential NPE in CgroupCenter#isSubSystemEnabled and 
> RAS_Node#totalSlotsUsed
> --------------------------------------------------------------------------------
>
>                 Key: STORM-3051
>                 URL: https://issues.apache.org/jira/browse/STORM-3051
>             Project: Apache Storm
>          Issue Type: Bug
>            Reporter: lujie
>            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 , IO exception), some of their callers have  _!=null_ check but 
> some do not have. 
> *Bug:*
> callee CgroupCenter#getSubSystems return null when meet exception:
> {code:java}
> } catch (Exception e) {
> LOG.error("Get subSystems error {}", e);
> }
> return null;
> {code}
> but its caller use it without check:
> {code:java}
> public boolean isSubSystemEnabled(SubSystemType subSystemType) {
>   Set<SubSystem> subSystems = this.getSubSystems();
>   for (SubSystem subSystem : subSystems) {
>      if (subSystem.getType() == subSystemType) {
>      return true;
>   }
>   }
>   return false;
> }{code}
> callee RAS_Node#getUsedSlots and caller RAS_Node#totalSlotsUsed have same 
> problem



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

Reply via email to