cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rafaelweingartner <...@git.apache.org>
Subject [GitHub] cloudstack pull request: Quota: findbug fixes
Date Thu, 07 Jan 2016 17:44:22 GMT
Github user rafaelweingartner commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1289#discussion_r49101734
  
    --- Diff: framework/quota/src/org/apache/cloudstack/quota/vo/ServiceOfferingVO.java ---
    @@ -310,14 +269,12 @@ public String getDeploymentPlanner() {
         }
     
         public String getDetail(String name) {
    -        assert (details != null) : "Did you forget to load the details?";
    -
    -        return details != null ? details.get(name) : null;
    +        if (details == null) throw new IllegalStateException("Cannot set value as details
is null");
    +        return details.get(name);
         }
     
         public void setDetail(String name, String value) {
    -        assert (details != null) : "Did you forget to load the details?";
    -
    +        if (details == null) throw new IllegalStateException("Cannot set value as details
is null");
    --- End diff --
    
    Do you really like this kind of solution? A POJO  with some kind of verification does
not seem like the best thing to have.
    
    Why don’t we initialize the as an empty map? This way it would be always ready for use,
and we would not need that verification. We could change line 81 to Map<String, String>
details = new HashMap<String, String> ();



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message