brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grkvlt <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Fix various integration tests
Date Fri, 31 Oct 2014 14:13:39 GMT
Github user grkvlt commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/285#discussion_r19668474
  
    --- Diff: utils/common/src/main/java/brooklyn/util/net/Networking.java ---
    @@ -162,16 +162,15 @@ public static int checkPortValid(Integer port, String errorMessage)
{
             return port;
         }
     
    -    public static void checkPortsValid(@SuppressWarnings("rawtypes") Map ports) {
    -        for (Object ppo : ports.entrySet()) {
    -            Map.Entry<?,?> pp = (Map.Entry<?,?>)ppo;
    -            Object val = pp.getValue();
    -            if(val == null){
    -                throw new IllegalArgumentException("port for "+pp.getKey()+" is null");
    -            }else if (!(val instanceof Integer)) {
    -                throw new IllegalArgumentException("port "+val+" for "+pp.getKey()+"
is not an integer ("+val.getClass()+")");
    +    public static void checkPortsValid(Map<?, ?> ports) {
    +        for (Map.Entry<?,?> entry : ports.entrySet()) {
    +            Object val = entry.getValue();
    +            if (val == null){
    --- End diff --
    
    Could use `Preconditions` with `checkNotNull(val, msg)` and `checkArgument(val instanceof
Integer, msg)` here?


---
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