cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From weiz...@apache.org
Subject [2/2] git commit: updated refs/heads/master to 880bff2
Date Mon, 18 Aug 2014 14:17:57 GMT
CLOUDSTACK-7362: fix wrong uuid issue for resource tags
(cherry picked from commit 838a1a8476cfb4308103b3797a281f843e208d38)


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

Branch: refs/heads/master
Commit: 880bff28e0521aa6696dac491556cd56fbd01eaa
Parents: b035a44
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Mon Aug 18 16:00:22 2014 +0200
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Mon Aug 18 16:17:36 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/880bff28/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);


Mime
View raw message