cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [08/50] [abbrv] git commit: updated refs/heads/saml2 to ba68616
Date Sun, 24 Aug 2014 14:04:28 GMT
Fixed few coverity defects


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

Branch: refs/heads/saml2
Commit: 4a6560a9ee440f8d2250813d9c0a4f8e86e0e01a
Parents: ac80535
Author: Santhosh Edukulla <santhosh.edukulla@gmail.com>
Authored: Thu Aug 21 12:42:22 2014 +0530
Committer: Santhosh Edukulla <santhosh.edukulla@gmail.com>
Committed: Thu Aug 21 12:43:11 2014 +0530

----------------------------------------------------------------------
 api/src/com/cloud/deploy/DeployDestination.java  | 19 ++++++++++++++-----
 .../command/user/vpn/CreateVpnConnectionCmd.java | 15 ++++++++++++---
 .../persist/dao/MultiPartUploadsDaoImpl.java     |  2 --
 .../cloudstack/messagebus/TestMessageBus.java    |  1 +
 .../network/resource/CiscoVnmcResource.java      |  5 +++--
 5 files changed, 30 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a6560a9/api/src/com/cloud/deploy/DeployDestination.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/deploy/DeployDestination.java b/api/src/com/cloud/deploy/DeployDestination.java
index 4ded5eb..eadc64e 100644
--- a/api/src/com/cloud/deploy/DeployDestination.java
+++ b/api/src/com/cloud/deploy/DeployDestination.java
@@ -134,14 +134,23 @@ public class DeployDestination implements Serializable {
         destination.append("Host(").append(hostId).append(")").append("-");
         destination.append("Storage(");
         if (_storage != null) {
-            String storageStr = "";
+            StringBuffer storageBuf = new StringBuffer();
+            //String storageStr = "";
             for (Volume vol : _storage.keySet()) {
-                if (!storageStr.equals("")) {
-                    storageStr = storageStr + ", ";
+                if (!storageBuf.toString().equals("")) {
+                    storageBuf.append(storageBuf.toString());
+                    storageBuf.append(", ");
                 }
-                storageStr = storageStr + "Volume(" + vol.getId() + "|" + vol.getVolumeType().name()
+ "-->Pool(" + _storage.get(vol).getId() + ")";
+                storageBuf.append(storageBuf);
+                storageBuf.append("Volume(");
+                storageBuf.append(vol.getId());
+                storageBuf.append("|");
+                storageBuf.append(vol.getVolumeType().name());
+                storageBuf.append("-->Pool(");
+                storageBuf.append(_storage.get(vol).getId());
+                storageBuf.append(")");
             }
-            destination.append(storageStr);
+            destination.append(storageBuf.toString());
         }
         return destination.append(")]").toString();
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a6560a9/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
index 6c08a42..c92bc89 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
@@ -112,8 +112,12 @@ public class CreateVpnConnectionCmd extends BaseAsyncCreateCmd {
 
     @Override
     public long getEntityOwnerId() {
-        Vpc vpc = _entityMgr.findById(Vpc.class, getVpnGateway().getVpcId());
-        return vpc.getAccountId();
+        Site2SiteVpnGateway  vpnGw = getVpnGateway();
+        if (vpnGw != null) {
+            Vpc vpc = _entityMgr.findById(Vpc.class, getVpnGateway().getVpcId());
+            return vpc.getAccountId();
+        }
+        return -1;
     }
 
     @Override
@@ -167,7 +171,12 @@ public class CreateVpnConnectionCmd extends BaseAsyncCreateCmd {
 
     @Override
     public Long getSyncObjId() {
-        return getVpnGateway().getVpcId();
+        Site2SiteVpnGateway vpnGw = getVpnGateway();
+        if (vpnGw != null)
+        {
+          return vpnGw.getVpcId();
+        }
+        return null;
     }
 
     private Site2SiteVpnGateway getVpnGateway() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a6560a9/awsapi/src/com/cloud/bridge/persist/dao/MultiPartUploadsDaoImpl.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/persist/dao/MultiPartUploadsDaoImpl.java b/awsapi/src/com/cloud/bridge/persist/dao/MultiPartUploadsDaoImpl.java
index 8ef7839..a914442 100644
--- a/awsapi/src/com/cloud/bridge/persist/dao/MultiPartUploadsDaoImpl.java
+++ b/awsapi/src/com/cloud/bridge/persist/dao/MultiPartUploadsDaoImpl.java
@@ -87,8 +87,6 @@ public class MultiPartUploadsDaoImpl extends GenericDaoBase<MultiPartUploadsVO,
     @Override
     public List<MultiPartUploadsVO> getInitiatedUploads(String bucketName, int maxParts,
String prefix, String keyMarker, String uploadIdMarker) {
 
-        List<MultiPartUploadsVO> uploadList = new ArrayList<MultiPartUploadsVO>();
-
         SearchBuilder<MultiPartUploadsVO> byBucket = createSearchBuilder();
         byBucket.and("BucketName", byBucket.entity().getBucketName(), SearchCriteria.Op.EQ);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a6560a9/framework/ipc/test/org/apache/cloudstack/messagebus/TestMessageBus.java
----------------------------------------------------------------------
diff --git a/framework/ipc/test/org/apache/cloudstack/messagebus/TestMessageBus.java b/framework/ipc/test/org/apache/cloudstack/messagebus/TestMessageBus.java
index cfa552c..64e4f88 100644
--- a/framework/ipc/test/org/apache/cloudstack/messagebus/TestMessageBus.java
+++ b/framework/ipc/test/org/apache/cloudstack/messagebus/TestMessageBus.java
@@ -139,6 +139,7 @@ public class TestMessageBus extends TestCase {
             int count = 0;
             while (count < 2) {
                 detector.waitAny(1000);
+                count = count + 1;
             }
         } finally {
             detector.close();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a6560a9/plugins/network-elements/cisco-vnmc/src/com/cloud/network/resource/CiscoVnmcResource.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/resource/CiscoVnmcResource.java
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/resource/CiscoVnmcResource.java
index ed75871..44260e4 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/resource/CiscoVnmcResource.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/resource/CiscoVnmcResource.java
@@ -668,9 +668,10 @@ public class CiscoVnmcResource implements ServerResource {
             s_logger.error(msg, e);
             return new Answer(cmd, false, msg);
         } finally {
-            helper.disconnect();
+            if( helper != null) {
+                helper.disconnect();
+            }
         }
-
         return new Answer(cmd, true, "Success");
     }
 


Mime
View raw message