You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2010/06/11 23:46:57 UTC

svn commit: r953885 - /qpid/trunk/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp

Author: tross
Date: Fri Jun 11 21:46:57 2010
New Revision: 953885

URL: http://svn.apache.org/viewvc?rev=953885&view=rev
Log:
Fixed a bug in which QMF error return codes were being sent back as 7 - Exception.

Modified:
    qpid/trunk/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp?rev=953885&r1=953884&r2=953885&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp Fri Jun 11 21:46:57 2010
@@ -499,8 +499,8 @@ void ManagementAgentImpl::invokeMethodRe
 
     if ((oid = inMap.find("_object_id")) == inMap.end() ||
         (mid = inMap.find("_method_name")) == inMap.end()) {
-        (outMap["_values"].asMap())["_status_code"] = Manageable::STATUS_PARAMETER_INVALID;
-        (outMap["_values"].asMap())["_status_text"] = Manageable::StatusText(Manageable::STATUS_PARAMETER_INVALID);
+        sendException(replyTo, cid, Manageable::StatusText(Manageable::STATUS_PARAMETER_INVALID),
+                      Manageable::STATUS_PARAMETER_INVALID);
         failed = true;
     } else {
         string methodName;
@@ -520,8 +520,8 @@ void ManagementAgentImpl::invokeMethodRe
 
             ManagementObjectMap::iterator iter = managementObjects.find(objId);
             if (iter == managementObjects.end() || iter->second->isDeleted()) {
-                (outMap["_values"].asMap())["_status_code"] = Manageable::STATUS_UNKNOWN_OBJECT;
-                (outMap["_values"].asMap())["_status_text"] = Manageable::StatusText(Manageable::STATUS_UNKNOWN_OBJECT);
+                sendException(replyTo, cid, Manageable::StatusText(Manageable::STATUS_UNKNOWN_OBJECT),
+                              Manageable::STATUS_UNKNOWN_OBJECT);
                 failed = true;
             } else {
                 iter->second->doMethod(methodName, inArgs, callMap);
@@ -534,33 +534,25 @@ void ManagementAgentImpl::invokeMethodRe
                     if (iter->first != "_status_code" && iter->first != "_status_text")
                         outMap["_arguments"].asMap()[iter->first] = iter->second;
             } else {
-                (outMap["_values"].asMap())["_status_code"] = callMap["_status_code"];
-                (outMap["_values"].asMap())["_status_text"] = callMap["_status_text"];
+                sendException(replyTo, cid, callMap["_status_text"], callMap["_status_code"]);
                 failed = true;
             }
 
         } catch(types::InvalidConversion& e) {
-            outMap.clear();
-            outMap["_values"] = Variant::Map();
-            (outMap["_values"].asMap())["_status_code"] = Manageable::STATUS_EXCEPTION;
-            (outMap["_values"].asMap())["_status_text"] = e.what();
+            sendException(replyTo, cid, e.what(), Manageable::STATUS_EXCEPTION);
             failed = true;
         }
     }
 
-    Variant::Map headers;
-    headers["method"] = "response";
-    headers["qmf.agent"] = name_address;
-    if (failed) {
-        headers["qmf.opcode"] = "_exception";
-        QPID_LOG(trace, "SENT Exception map=" << outMap);
-    } else {
+    if (!failed) {
+        Variant::Map headers;
+        headers["method"] = "response";
+        headers["qmf.agent"] = name_address;
         headers["qmf.opcode"] = "_method_response";
         QPID_LOG(trace, "SENT MethodResponse map=" << outMap);
+        MapCodec::encode(outMap, content);
+        connThreadBody.sendBuffer(content, cid, headers, "qmf.default.direct", replyTo);
     }
-
-    MapCodec::encode(outMap, content);
-    connThreadBody.sendBuffer(content, cid, headers, "qmf.default.direct", replyTo);
 }
 
 void ManagementAgentImpl::handleGetQuery(const string& body, const string& cid, const string& replyTo)



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org