cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kous...@apache.org
Subject [1/2] git commit: updated refs/heads/master to 724bb82
Date Fri, 28 Aug 2015 14:37:15 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master ffd0b3bd0 -> 724bb821a


Coverity Issue: NUll Pointer dereferncing fixed and commits squashed.


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

Branch: refs/heads/master
Commit: fe7df9680494bec8459e3bc744d743696a04fbc6
Parents: 61da853
Author: Kshitij Kansal <kansal.k@gmail.com>
Authored: Thu Aug 27 16:06:11 2015 +0530
Committer: Kshitij Kansal <kansal.k@gmail.com>
Committed: Fri Aug 28 16:05:01 2015 +0530

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiResponseHelper.java | 23 +++++++++++---------
 1 file changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fe7df968/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 0a9d9c4..06c68c4 100644
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -30,6 +30,7 @@ import java.util.TimeZone;
 
 import javax.inject.Inject;
 
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.cloudstack.acl.ControlledEntity;
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import org.apache.cloudstack.affinity.AffinityGroup;
@@ -504,7 +505,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
         for (ResourceTag tag : tags) {
             ResourceTagResponse tagResponse = createResourceTagResponse(tag, true);
-            tagResponses.add(tagResponse);
+            CollectionUtils.addIgnoreNull(tagResponses, tagResponse);
         }
         snapshotResponse.setTags(tagResponses);
 
@@ -789,7 +790,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
         for (ResourceTag tag : tags) {
             ResourceTagResponse tagResponse = createResourceTagResponse(tag, true);
-            tagResponses.add(tagResponse);
+            CollectionUtils.addIgnoreNull(tagResponses, tagResponse);
         }
         ipResponse.setTags(tagResponses);
 
@@ -831,7 +832,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
         for (ResourceTag tag : tags) {
             ResourceTagResponse tagResponse = createResourceTagResponse(tag, true);
-            tagResponses.add(tagResponse);
+            CollectionUtils.addIgnoreNull(tagResponses, tagResponse);
         }
         lbResponse.setTags(tagResponses);
 
@@ -1118,7 +1119,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
         for (ResourceTag tag : tags) {
             ResourceTagResponse tagResponse = createResourceTagResponse(tag, true);
-            tagResponses.add(tagResponse);
+            CollectionUtils.addIgnoreNull(tagResponses, tagResponse);
         }
         response.setTags(tagResponses);
 
@@ -2071,7 +2072,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
         for (ResourceTag tag : tags) {
             ResourceTagResponse tagResponse = createResourceTagResponse(tag, true);
-            tagResponses.add(tagResponse);
+            CollectionUtils.addIgnoreNull(tagResponses, tagResponse);
         }
         response.setTags(tagResponses);
 
@@ -2157,7 +2158,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
         for (ResourceTag tag : tags) {
             ResourceTagResponse tagResponse = createResourceTagResponse(tag, true);
-            tagResponses.add(tagResponse);
+            CollectionUtils.addIgnoreNull(tagResponses, tagResponse);
         }
         response.setTags(tagResponses);
 
@@ -2208,7 +2209,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
         for (ResourceTag tag : tags) {
             ResourceTagResponse tagResponse = createResourceTagResponse(tag, true);
-            tagResponses.add(tagResponse);
+            CollectionUtils.addIgnoreNull(tagResponses, tagResponse);
         }
         response.setTags(tagResponses);
 
@@ -2644,6 +2645,8 @@ public class ApiResponseHelper implements ResponseGenerator {
     @Override
     public ResourceTagResponse createResourceTagResponse(ResourceTag resourceTag, boolean
keyValueOnly) {
         ResourceTagJoinVO rto = ApiDBUtils.newResourceTagView(resourceTag);
+        if(rto == null)
+            return null;
         return ApiDBUtils.newResourceTagResponse(rto, keyValueOnly);
     }
 
@@ -2752,7 +2755,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
         for (ResourceTag tag : tags) {
             ResourceTagResponse tagResponse = createResourceTagResponse(tag, true);
-            tagResponses.add(tagResponse);
+            CollectionUtils.addIgnoreNull(tagResponses, tagResponse);
         }
         response.setTags(tagResponses);
         response.setObjectName("vpc");
@@ -2943,7 +2946,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
         for (ResourceTag tag : tags) {
             ResourceTagResponse tagResponse = createResourceTagResponse(tag, true);
-            tagResponses.add(tagResponse);
+            CollectionUtils.addIgnoreNull(tagResponses,tagResponse);
         }
         response.setTags(tagResponses);
         response.setObjectName("staticroute");
@@ -3511,7 +3514,7 @@ public class ApiResponseHelper implements ResponseGenerator {
         List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
         for (ResourceTag tag : tags) {
             ResourceTagResponse tagResponse = createResourceTagResponse(tag, true);
-            tagResponses.add(tagResponse);
+            CollectionUtils.addIgnoreNull(tagResponses,tagResponse);
         }
         lbResponse.setTags(tagResponses);
 


Mime
View raw message