cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gir...@apache.org
Subject [31/50] git commit: updated refs/heads/marvin to df58f51
Date Wed, 29 Jan 2014 08:54:06 GMT
findbugs: nullpointer guards and wrappertype comparisons(cherry picked
from commit 791b7f8f7fe8f7d342e46fbb61a3f421e87fca59)

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

Branch: refs/heads/marvin
Commit: 5d8e8fd3a2e8ffe9a2147129a9715a29cb4ce064
Parents: 9edeb24
Author: Daan Hoogland <daan@onecht.net>
Authored: Tue Jan 28 16:46:05 2014 +0100
Committer: Daan Hoogland <dhoogland@schubergphilis.com>
Committed: Tue Jan 28 16:46:05 2014 +0100

----------------------------------------------------------------------
 .../com/cloud/resourcelimit/ResourceLimitManagerImpl.java |  2 +-
 server/src/com/cloud/storage/VolumeApiServiceImpl.java    |  4 ++--
 server/src/com/cloud/vm/UserVmManagerImpl.java            | 10 +++++-----
 3 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5d8e8fd3/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java b/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
index 3a7251b..13c3051 100755
--- a/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
+++ b/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
@@ -877,7 +877,7 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim
                 }
                 _resourceCountDao.setResourceCount(accountId, ResourceOwnerType.Account,
type, (newCount == null) ? 0 : newCount.longValue());
 
-                if (oldCount != newCount) {
+                if (!Long.valueOf(oldCount).equals(newCount)) {
                     s_logger.info("Discrepency in the resource count " + "(original count="
+ oldCount + " correct count = " + newCount + ") for type " + type +
                         " for account ID " + accountId + " is fixed during resource count
recalculation.");
                 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5d8e8fd3/server/src/com/cloud/storage/VolumeApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index a79d8b4..55582c6 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -449,8 +449,8 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
                 volume.setPoolId(null);
                 volume.setDataCenterId(zoneId);
                 volume.setPodId(null);
-                volume.setAccountId(owner.getAccountId());
-                volume.setDomainId(owner.getDomainId());
+                volume.setAccountId((owner == null) ? null : owner.getAccountId());
+                volume.setDomainId((owner == null) ? Domain.ROOT_DOMAIN : owner.getDomainId());
                 long diskOfferingId = _diskOfferingDao.findByUniqueName("Cloud.com-Custom").getId();
                 volume.setDiskOfferingId(diskOfferingId);
                 // volume.setSize(size);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5d8e8fd3/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 85f3527..1dcaf79 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -34,6 +34,9 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.commons.codec.binary.Base64;
+import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 import org.apache.cloudstack.affinity.AffinityGroupService;
@@ -79,8 +82,6 @@ import org.apache.cloudstack.managed.context.ManagedContextRunnable;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.cloudstack.storage.to.TemplateObjectTO;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.log4j.Logger;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
@@ -458,7 +459,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
     protected boolean _dailyOrHourly = false;
     private int capacityReleaseInterval;
 
-    protected String _name;
     protected String _instance;
     protected String _zone;
     protected boolean _instanceNameFlag;
@@ -4004,13 +4004,13 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
 
         //if hosts are dedicated to different account/domains, raise an alert
         if (srcExplDedicated && destExplDedicated) {
-            if ((accountOfDedicatedHost(srcHost) != null) && (accountOfDedicatedHost(srcHost)
!= accountOfDedicatedHost(destHost))) {
+            if (!((accountOfDedicatedHost(srcHost) == null) || (accountOfDedicatedHost(srcHost).equals(accountOfDedicatedHost(destHost)))))
{
                 String msg = "VM is being migrated from host " + srcHost.getName() + " explicitly
dedicated to account " + accountOfDedicatedHost(srcHost) + " to host "
                         + destHost.getName() + " explicitly dedicated to account " + accountOfDedicatedHost(destHost);
                 _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_USERVM, vm.getDataCenterId(),
vm.getPodIdToDeployIn(), msg, msg);
                 s_logger.warn(msg);
             }
-            if ((domainOfDedicatedHost(srcHost) != null) && (domainOfDedicatedHost(srcHost)
!= domainOfDedicatedHost(destHost))) {
+            if (!((domainOfDedicatedHost(srcHost) == null) || (domainOfDedicatedHost(srcHost).equals(domainOfDedicatedHost(destHost)))))
{
                 String msg = "VM is being migrated from host " + srcHost.getName() + " explicitly
dedicated to domain " + domainOfDedicatedHost(srcHost) + " to host "
                         + destHost.getName() + " explicitly dedicated to domain " + domainOfDedicatedHost(destHost);
                 _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_USERVM, vm.getDataCenterId(),
vm.getPodIdToDeployIn(), msg, msg);


Mime
View raw message