summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
authorCharles E. Rolke <chug@apache.org>2012-11-07 17:23:58 +0000
committerCharles E. Rolke <chug@apache.org>2012-11-07 17:23:58 +0000
commit093bd37d04483cb0c84c88600acbc96174a5accd (patch)
treed5e4df9369256c6c2bd5a3d0f55ba230915b6ed3 /qpid/cpp
parent0e8386879eec4569e8178b85006dd1e47a77806b (diff)
downloadqpid-python-093bd37d04483cb0c84c88600acbc96174a5accd.tar.gz
QPID-4427 C++ Messaging Client .NET Binding failed to wrap receiver.close().
Also add exception handler to closing section of map callback receiver example. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1406725 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/configure-windows.ps14
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs14
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp31
3 files changed, 42 insertions, 7 deletions
diff --git a/qpid/cpp/bindings/qpid/dotnet/configure-windows.ps1 b/qpid/cpp/bindings/qpid/dotnet/configure-windows.ps1
index 162ac272b4..17c2d486db 100644
--- a/qpid/cpp/bindings/qpid/dotnet/configure-windows.ps1
+++ b/qpid/cpp/bindings/qpid/dotnet/configure-windows.ps1
@@ -496,7 +496,7 @@ if ($make32) {
$env:BOOST_ROOT = "$boost32"
cd "$build32"
Write-Host "Running 32-bit CMake in $build32 ..."
- CMake -G "$global:cmakeGenerator" "-DCMAKE_INSTALL_PREFIX=install_x86" $cppDir
+ CMake -G "$global:cmakeGenerator" "-DGEN_DOXYGEN=No" "-DCMAKE_INSTALL_PREFIX=install_x86" $cppDir
} else {
Write-Host "Skipped 32-bit CMake."
}
@@ -508,7 +508,7 @@ if ($make64) {
$env:BOOST_ROOT = "$boost64"
cd "$build64"
Write-Host "Running 64-bit CMake in $build64"
- CMake -G "$global:cmakeGenerator Win64" "-DCMAKE_INSTALL_PREFIX=install_x64" $cppDir
+ CMake -G "$global:cmakeGenerator Win64" "-DGEN_DOXYGEN=No" "-DCMAKE_INSTALL_PREFIX=install_x64" $cppDir
} else {
Write-Host "Skipped 64-bit CMake."
}
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs
index 72ddd44120..3bc22b2ce8 100644
--- a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs
@@ -162,6 +162,7 @@ namespace Org.Apache.Qpid.Messaging.Examples
/// <param name="exception">The exception.</param>
public void SessionException(Exception exception)
{
+ // A typical application will take more action here.
Console.WriteLine("{0} Exception caught.", exception.ToString());
}
@@ -273,8 +274,17 @@ namespace Org.Apache.Qpid.Messaging.Examples
//
// Close the receiver and the connection.
//
- receiver.Close();
- connection.Close();
+ try
+ {
+ receiver.Close();
+ connection.Close();
+ }
+ catch (Exception exception)
+ {
+ // receiver or connection may throw if they closed in error.
+ // A typical application will take more action here.
+ Console.WriteLine("{0} Closing exception caught.", exception.ToString());
+ }
return 0;
}
}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp b/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp
index bbd7dd4c52..43bb7dd3cb 100644
--- a/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp
@@ -344,9 +344,34 @@ namespace Messaging {
void Receiver::Close()
{
- msclr::lock lk(privateLock);
- ThrowIfDisposed();
+ System::Exception ^ newException = nullptr;
+ Message ^ newMessage = nullptr;
- nativeObjPtr->close();
+ try
+ {
+ msclr::lock lk(privateLock);
+ ThrowIfDisposed();
+
+ nativeObjPtr->close();
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+ finally
+ {
+ if (newException != nullptr)
+ {
+ if (newMessage != nullptr)
+ {
+ delete newMessage;
+ }
+ }
+ }
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
}
}}}}