incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject [1/3] git commit: refs/heads/master - CLOUDSTACK-1401 NPE: listCapacity
Date Thu, 28 Feb 2013 03:51:33 GMT
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 <mice_xia@tcloudcomputing.com>
Authored: Thu Feb 28 11:46:10 2013 +0800
Committer: Mice Xia <mice_xia@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);
             }


Mime
View raw message