You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2013/01/23 23:57:56 UTC

[8/9] git commit: ApiDispatcher: Fix uuid->id translation and throw better debug statement

ApiDispatcher: Fix uuid->id translation and throw better debug statement

Signed-off-by: Rohit Yadav <bh...@apache.org>


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

Branch: refs/heads/master
Commit: a7fd74f94a29ac64cd4ac03e079b38252005a0a7
Parents: 03d2c01
Author: Rohit Yadav <bh...@apache.org>
Authored: Wed Jan 23 14:56:34 2013 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Wed Jan 23 14:57:41 2013 -0800

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiDispatcher.java |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a7fd74f9/server/src/com/cloud/api/ApiDispatcher.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java
index 4ca040c..f7d881d 100755
--- a/server/src/com/cloud/api/ApiDispatcher.java
+++ b/server/src/com/cloud/api/ApiDispatcher.java
@@ -158,8 +158,7 @@ public class ApiDispatcher {
                 }
 
                 if (queueSizeLimit != null) {
-                    _asyncMgr
-                            .syncAsyncJobExecution(asyncCmd.getJob(), asyncCmd.getSyncObjType(), asyncCmd.getSyncObjId().longValue(), queueSizeLimit);
+                    _asyncMgr.syncAsyncJobExecution(asyncCmd.getJob(), asyncCmd.getSyncObjType(), asyncCmd.getSyncObjId().longValue(), queueSizeLimit);
                 } else {
                     s_logger.trace("The queue size is unlimited, skipping the synchronizing");
                 }
@@ -360,8 +359,9 @@ public class ApiDispatcher {
         // Go through each entity which is an interface to a VO class and get a VO object
         // Try to getId() for the object using reflection, break on first non-null value
         for (Class<?> entity: entities) {
-            // findByUuid returns one VO object using uuid, use reflect to get the Id
-            Object objVO = s_instance._entityMgr.findByUuid(entity, uuid);
+            // For backward compatibility, we search within removed entities and let service layer deal
+            // with removed ones, return empty response or error
+            Object objVO = s_instance._entityMgr.findByUuidIncludingRemoved(entity, uuid);
             if (objVO == null) {
                 continue;
             }
@@ -377,11 +377,10 @@ public class ApiDispatcher {
                 break;
         }
         if (internalId == null) {
-            if (s_logger.isDebugEnabled()) {
-                s_logger.debug("Object entity with uuid=" + uuid + " does not exist in the database.");
-            }
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Object entity uuid = " + uuid + " does not exist in the database.");
             throw new InvalidParameterValueException("Invalid parameter value=" + uuid
-                    + " due to incorrect long value, entity not found, or an annotation bug.");
+                + " due to incorrect long value format, or entity was not found as it may have been deleted, or due to incorrect parameter annotation for the field in api cmd.");
         }
         return internalId;
     }