Repository: cloudstack
Updated Branches:
  refs/heads/master bf9036c5a -> dda282055


Fixed Coverity reported type issues


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/dda28205
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/dda28205
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/dda28205

Branch: refs/heads/master
Commit: dda2820552f943f65c835cc3495c849ff2c060e4
Parents: bf9036c
Author: Santhosh Edukulla <santhosh.eduku...@gmail.com>
Authored: Wed Aug 6 15:27:00 2014 +0530
Committer: Santhosh Edukulla <santhosh.eduku...@gmail.com>
Committed: Wed Aug 6 15:27:00 2014 +0530

----------------------------------------------------------------------
 .../command/user/firewall/CreateFirewallRuleCmd.java   | 13 +++++++------
 .../src/com/cloud/network/rules/StaticNatRuleImpl.java |  4 ++--
 .../cloud/network/vpn/RemoteAccessVpnManagerImpl.java  |  2 +-
 .../network/lb/ApplicationLoadBalancerManagerImpl.java |  6 +++---
 4 files changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dda28205/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
index 0666935..7595d36 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
@@ -177,7 +177,7 @@ public class CreateFirewallRuleCmd extends 
BaseAsyncCreateCmd implements Firewal
     @Override
     public Integer getSourcePortStart() {
         if (publicStartPort != null) {
-            return publicStartPort.intValue();
+            return publicStartPort;
         }
         return null;
     }
@@ -186,10 +186,10 @@ public class CreateFirewallRuleCmd extends 
BaseAsyncCreateCmd implements Firewal
     public Integer getSourcePortEnd() {
         if (publicEndPort == null) {
             if (publicStartPort != null) {
-                return publicStartPort.intValue();
+                return publicStartPort;
             }
         } else {
-            return publicEndPort.intValue();
+            return publicEndPort;
         }
 
         return null;
@@ -247,11 +247,12 @@ public class CreateFirewallRuleCmd extends 
BaseAsyncCreateCmd implements Firewal
                 }
             }
         }
-
         try {
             FirewallRule result = 
_firewallService.createIngressFirewallRule(this);
-            setEntityId(result.getId());
-            setEntityUuid(result.getUuid());
+            if (result != null) {
+                setEntityId(result.getId());
+                setEntityUuid(result.getUuid());
+            }
         } catch (NetworkRuleConflictException ex) {
             s_logger.info("Network rule conflict: " + ex.getMessage());
             s_logger.trace("Network Rule Conflict: ", ex);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dda28205/engine/components-api/src/com/cloud/network/rules/StaticNatRuleImpl.java
----------------------------------------------------------------------
diff --git 
a/engine/components-api/src/com/cloud/network/rules/StaticNatRuleImpl.java 
b/engine/components-api/src/com/cloud/network/rules/StaticNatRuleImpl.java
index 9a49db0..d21159b 100644
--- a/engine/components-api/src/com/cloud/network/rules/StaticNatRuleImpl.java
+++ b/engine/components-api/src/com/cloud/network/rules/StaticNatRuleImpl.java
@@ -38,8 +38,8 @@ public class StaticNatRuleImpl implements StaticNatRule {
         xid = rule.getXid();
         uuid = rule.getUuid();
         protocol = rule.getProtocol();
-        portStart = rule.getSourcePortStart();
-        portEnd = rule.getSourcePortEnd();
+        portStart = rule.getSourcePortStart().intValue();
+        portEnd = rule.getSourcePortEnd().intValue();
         state = rule.getState();
         accountId = rule.getAccountId();
         domainId = rule.getDomainId();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dda28205/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java 
b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
index f4d8947..f9a1586 100755
--- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
@@ -363,7 +363,7 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase 
implements RemoteAcc
                                     for (FirewallRule vpnFwRule : vpnFwRules) {
                                         _rulesDao.remove(vpnFwRule.getId());
                                         s_logger.debug("Successfully removed 
firewall rule with ip id=" + vpnFwRule.getSourceIpAddressId() + " and port " +
-                                            vpnFwRule.getSourcePortStart() + " 
as a part of vpn cleanup");
+                                            
vpnFwRule.getSourcePortStart().intValue() + " as a part of vpn cleanup");
                                     }
                                 }
                             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dda28205/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
 
b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
index af8dc82..bc2f1c4 100644
--- 
a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
+++ 
b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
@@ -185,7 +185,7 @@ public class ApplicationLoadBalancerManagerImpl extends 
ManagerBase implements A
                         throw new CloudRuntimeException("Unable to update the 
state to add for " + newRule);
                     }
                     s_logger.debug("Load balancer " + newRule.getId() + " for 
Ip address " + newRule.getSourceIp().addr() + ", source port " +
-                        newRule.getSourcePortStart() + ", instance port " + 
newRule.getDefaultPortStart() + " is added successfully.");
+                        newRule.getSourcePortStart().intValue() + ", instance 
port " + newRule.getDefaultPortStart() + " is added successfully.");
                     CallContext.current().setEventDetails("Load balancer Id: " 
+ newRule.getId());
                     Network ntwk = 
_networkModel.getNetwork(newRule.getNetworkId());
                     
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_LOAD_BALANCER_CREATE, 
newRule.getAccountId(), ntwk.getDataCenterId(), newRule.getId(), null,
@@ -527,8 +527,8 @@ public class ApplicationLoadBalancerManagerImpl extends 
ManagerBase implements A
                 (newLbRule.getSourcePortStart().intValue() <= 
lbRule.getSourcePortEnd().intValue() && newLbRule.getSourcePortEnd().intValue() 
>= lbRule.getSourcePortEnd()
                     .intValue())) {
 
-                throw new NetworkRuleConflictException("The range specified, " 
+ newLbRule.getSourcePortStart() + "-" + newLbRule.getSourcePortEnd() +
-                    ", conflicts with rule " + lbRule.getId() + " which has " 
+ lbRule.getSourcePortStart() + "-" + lbRule.getSourcePortEnd());
+                throw new NetworkRuleConflictException("The range specified, " 
+ newLbRule.getSourcePortStart().intValue() + "-" + 
newLbRule.getSourcePortEnd().intValue() +
+                    ", conflicts with rule " + lbRule.getId() + " which has " 
+ lbRule.getSourcePortStart().intValue() + "-" + 
lbRule.getSourcePortEnd().intValue());
             }
         }
 

Reply via email to