cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kis...@apache.org
Subject git commit: updated refs/heads/4.2 to a6d6468
Date Tue, 13 Aug 2013 13:28:13 GMT
Updated Branches:
  refs/heads/4.2 836c4c431 -> a6d646856


CLOUDSTACK-4289, CLOUDSTACK-4290, CLOUDSTACK-4291 : Check for null when populated UUID while
listing usage records.
Filed CLOUDSTACK-4299 to make these entities always available.


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

Branch: refs/heads/4.2
Commit: a6d64685661222b8632252b6042e2c8013419eca
Parents: 836c4c4
Author: Kishan Kavala <kishan@cloud.com>
Authored: Tue Aug 13 18:49:56 2013 +0530
Committer: Kishan Kavala <kishan@cloud.com>
Committed: Tue Aug 13 18:57:46 2013 +0530

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiResponseHelper.java | 25 +++++++++++---------
 1 file changed, 14 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a6d64685/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index 13b331c..7ffb133 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -3349,27 +3349,30 @@ public class ApiResponseHelper implements ResponseGenerator {
 			//Snapshot Size
 			usageRecResponse.setSize(usageRecord.getSize());
 
-		} else if(usageRecord.getUsageType() == UsageTypes.LOAD_BALANCER_POLICY){
-			//Load Balancer Policy ID
+        } else if(usageRecord.getUsageType() == UsageTypes.LOAD_BALANCER_POLICY){
+            //Load Balancer Policy ID
             LoadBalancerVO lb = _entityMgr.findByIdIncludingRemoved(LoadBalancerVO.class,
usageRecord.getUsageId().toString());
-            usageRecResponse.setUsageId(lb.getUuid());
-		} else if(usageRecord.getUsageType() == UsageTypes.PORT_FORWARDING_RULE){
-			//Port Forwarding Rule ID
+            if(lb != null){
+                usageRecResponse.setUsageId(lb.getUuid());
+            }
+        } else if(usageRecord.getUsageType() == UsageTypes.PORT_FORWARDING_RULE){
+            //Port Forwarding Rule ID
             PortForwardingRuleVO pf = _entityMgr.findByIdIncludingRemoved(PortForwardingRuleVO.class,
usageRecord.getUsageId().toString());
-            usageRecResponse.setUsageId(pf.getUuid());
-
+            if(pf != null){
+                usageRecResponse.setUsageId(pf.getUuid());
+            }
 		} else if(usageRecord.getUsageType() == UsageTypes.NETWORK_OFFERING){
 			//Network Offering Id
 			NetworkOfferingVO netOff = _entityMgr.findByIdIncludingRemoved(NetworkOfferingVO.class,
usageRecord.getOfferingId().toString());
 			usageRecResponse.setOfferingId(netOff.getUuid());
 			//is Default
 			usageRecResponse.setDefault((usageRecord.getUsageId() == 1)? true:false);
-
-		} else if(usageRecord.getUsageType() == UsageTypes.VPN_USERS){
-			//VPN User ID
+        } else if(usageRecord.getUsageType() == UsageTypes.VPN_USERS){
+            //VPN User ID
             VpnUserVO vpnUser = _entityMgr.findByIdIncludingRemoved(VpnUserVO.class, usageRecord.getUsageId().toString());
+            if(vpnUser != null){
             usageRecResponse.setUsageId(vpnUser.getUuid());
-
+            }
 		} else if(usageRecord.getUsageType() == UsageTypes.SECURITY_GROUP){
 			//Security Group Id
 			SecurityGroupVO sg = _entityMgr.findByIdIncludingRemoved(SecurityGroupVO.class, usageRecord.getUsageId().toString());


Mime
View raw message