diff options
| author | Charles E. Rolke <chug@apache.org> | 2014-01-16 20:00:36 +0000 |
|---|---|---|
| committer | Charles E. Rolke <chug@apache.org> | 2014-01-16 20:00:36 +0000 |
| commit | 6991d18b7d5f776afc21b970caced01b2cb19034 (patch) | |
| tree | 6d8de8daebb3d19059d3eb844c682089e98f39d0 | |
| parent | a062e40dc16091af5fd4f3f67b1d9844ec9ce684 (diff) | |
| download | qpid-python-6991d18b7d5f776afc21b970caced01b2cb19034.tar.gz | |
QPID-5481: Messaging API Update - 1520416 Message setProperties(Variant::Map&) added
The .NET binding already had a Properties setter but it behaved worked by doing
recursive property Add and not a wholesale replace. This patch calls the new
setProperty method to get the correct behavior.
The Properties property does non trivial calls into the unmanaged code. This
patch also intercepts unmanaged exceptions from get and set and relays them
into managed space.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1558899 13f79535-47bb-0310-9956-ffa450edef68
| -rw-r--r-- | qpid/cpp/bindings/qpid/dotnet/src/Message.h | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Message.h b/qpid/cpp/bindings/qpid/dotnet/src/Message.h index aa436ed48d..2b64ef90f3 100644 --- a/qpid/cpp/bindings/qpid/dotnet/src/Message.h +++ b/qpid/cpp/bindings/qpid/dotnet/src/Message.h @@ -29,6 +29,7 @@ #include "QpidMarshal.h"
#include "Address.h"
#include "Duration.h"
+#include "QpidException.h"
#include "TypeTranslator.h"
namespace Org {
@@ -376,17 +377,27 @@ namespace Messaging { msclr::lock lk(privateLock);
ThrowIfDisposed();
- ::qpid::types::Variant::Map map;
+ System::Exception ^ newException = nullptr;
- map = nativeObjPtr->getProperties();
-
- System::Collections::Generic::Dictionary<
- System::String^, System::Object^> ^ dict =
- gcnew System::Collections::Generic::Dictionary<
- System::String^, System::Object^> ;
+ System::Collections::Generic::Dictionary<System::String^, System::Object^> ^ dict =
+ gcnew System::Collections::Generic::Dictionary<System::String^, System::Object^> ;
+ try
+ {
+ ::qpid::types::Variant::Map map;
+ map = nativeObjPtr->getProperties();
+ TypeTranslator::NativeToManaged(map, dict);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
- TypeTranslator::NativeToManaged(map, dict);
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
return dict;
}
@@ -398,10 +409,23 @@ namespace Messaging { msclr::lock lk(privateLock);
ThrowIfDisposed();
- for each (System::Collections::Generic::KeyValuePair
- <System::String^, System::Object^> kvp in properties)
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ ::qpid::types::Variant::Map variantMap;
+ TypeTranslator::ManagedToNative(properties, variantMap);
+ nativeObjPtr->setProperties(variantMap);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
{
- SetProperty(kvp.Key, kvp.Value);
+ throw newException;
}
}
}
|
