You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by we...@apache.org on 2014/08/18 16:06:25 UTC

[2/2] git commit: updated refs/heads/4.4 to 838a1a8

CLOUDSTACK-7362: fix wrong uuid issue for resource tags


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

Branch: refs/heads/4.4
Commit: 838a1a8476cfb4308103b3797a281f843e208d38
Parents: ae1b87c
Author: Wei Zhou <w....@leaseweb.com>
Authored: Mon Aug 18 16:00:22 2014 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Mon Aug 18 16:00:22 2014 +0200

----------------------------------------------------------------------
 server/src/com/cloud/tags/TaggedResourceManagerImpl.java | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/838a1a84/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
index 64474ec..dfe3ae0 100644
--- a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
+++ b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
@@ -32,6 +32,7 @@ import org.apache.cloudstack.api.Identity;
 import org.apache.cloudstack.api.InternalIdentity;
 import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 
 import com.cloud.api.query.dao.ResourceTagJoinDao;
@@ -167,6 +168,9 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso
         if (entity != null) {
             return ((InternalIdentity)entity).getId();
         }
+        if (!StringUtils.isNumeric(resourceId)) {
+            throw new InvalidParameterValueException("Unable to find resource by uuid " + resourceId + " and type " + resourceType);
+        }
         entity = _entityMgr.findById(clazz, resourceId);
         if (entity != null) {
             return ((InternalIdentity)entity).getId();
@@ -276,6 +280,10 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso
 
     @Override
     public String getUuid(String resourceId, ResourceObjectType resourceType) {
+        if (!StringUtils.isNumeric(resourceId)) {
+            return resourceId;
+        }
+
         Class<?> clazz = s_typeMap.get(resourceType);
 
         Object entity = _entityMgr.findById(clazz, resourceId);