You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mi...@apache.org on 2013/02/28 04:51:33 UTC

[1/3] git commit: refs/heads/master - CLOUDSTACK-1401 NPE: listCapacity

CLOUDSTACK-1401 NPE: listCapacity


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

Branch: refs/heads/master
Commit: 91417115ef119633c321234c5db5dc64ba93b239
Parents: 9afd33d
Author: Mice Xia <mi...@tcloudcomputing.com>
Authored: Thu Feb 28 11:46:10 2013 +0800
Committer: Mice Xia <mi...@tcloudcomputing.com>
Committed: Thu Feb 28 11:46:10 2013 +0800

----------------------------------------------------------------------
 .../com/cloud/capacity/dao/CapacityDaoImpl.java    |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/91417115/server/src/com/cloud/capacity/dao/CapacityDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/capacity/dao/CapacityDaoImpl.java b/server/src/com/cloud/capacity/dao/CapacityDaoImpl.java
index 3aef29b..1c23cb8 100755
--- a/server/src/com/cloud/capacity/dao/CapacityDaoImpl.java
+++ b/server/src/com/cloud/capacity/dao/CapacityDaoImpl.java
@@ -305,10 +305,17 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
             }
             ResultSet rs = pstmt.executeQuery();
             while (rs.next()) {
+                Long capacityPodId = null;
+                Long capacityClusterId = null;
+
+                if(level != 1 && rs.getLong(6) != 0)
+                    capacityPodId = rs.getLong(6);
+                if(level == 3 && rs.getLong(7) != 0)
+                    capacityClusterId = rs.getLong(7);                   
+
                 SummedCapacity summedCapacity = new SummedCapacity( rs.getLong(1), rs.getLong(2), rs.getFloat(3),
                         (short)rs.getLong(4), rs.getLong(5),
-                        level != 1 ? rs.getLong(6): null,
-                                level == 3 ? rs.getLong(7): null);
+                        capacityPodId, capacityClusterId);
 
                 result.add(summedCapacity);
             }