Github user revans2 commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2312#discussion_r138090558
  
    --- Diff: 
storm-client/src/jvm/org/apache/storm/topology/BaseConfigurationDeclarer.java 
---
    @@ -83,4 +83,29 @@ public T setCPULoad(Number amount) {
             }
             return (T) this;
         }
    +
    +    @SuppressWarnings("unchecked")
    +    @Override
    +    public T addResources(Map<String, Double> resources) {
    +        if(resources != null) {
    +            return 
addConfiguration(Config.TOPOLOGY_COMPONENT_RESOURCES_MAP, resources);
    +        }
    +        return (T) this;
    +    }
    +
    +    @SuppressWarnings("unchecked")
    +    @Override
    +    public T addResource(String resourceName, Double resourceValue) {
    +        Map<String, Double> resourcesMap = (Map<String, Double>) 
((Map<String, Object>) this).get(Config.TOPOLOGY_COMPONENT_RESOURCES_MAP);
    +
    +        if (resourcesMap != null) {
    --- End diff --
    
    I think you mean `if (resourcesMap == null) {` or we are going to be 
getting NPEs all over the place.


---

Reply via email to