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

Signed-off-by: Rohit Yadav <[email protected]>


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

Branch: refs/heads/marvin-refactor
Commit: eeacf5d74d4a7192f9b1601a37fad118dd273be8
Parents: e51786a
Author: Rohit Yadav <[email protected]>
Authored: Wed Jan 23 14:56:34 2013 -0800
Committer: Prasanna Santhanam <[email protected]>
Committed: Thu Jan 24 17:48:36 2013 +0530

----------------------------------------------------------------------
 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/eeacf5d7/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;
     }

Reply via email to