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 [email protected] or file a JIRA ticket
with INFRA.
---