diff options
author | Bernard Normier <bernard@zeroc.com> | 2014-10-29 20:38:19 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2014-10-29 20:38:19 +0000 |
commit | f29afb0ca26a0d4964a19d8fd5104cf5f0db81a3 (patch) | |
tree | e6a10ffa1f36d5d0726ff69bd6a91260e21d0259 /cpp/test/Ice/exceptions/AllTests.cpp | |
parent | Fixed (ICE-5800) - Slice build dependencies don't work properly in source tree (diff) | |
download | ice-f29afb0ca26a0d4964a19d8fd5104cf5f0db81a3.tar.bz2 ice-f29afb0ca26a0d4964a19d8fd5104cf5f0db81a3.tar.xz ice-f29afb0ca26a0d4964a19d8fd5104cf5f0db81a3.zip |
Fixed ICE-5796: LoggerUtil now deals properly with exceptions (print their stack traces when available)
Diffstat (limited to 'cpp/test/Ice/exceptions/AllTests.cpp')
-rw-r--r-- | cpp/test/Ice/exceptions/AllTests.cpp | 55 |
1 files changed, 49 insertions, 6 deletions
diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp index 5432ff35ee0..36a55f54c49 100644 --- a/cpp/test/Ice/exceptions/AllTests.cpp +++ b/cpp/test/Ice/exceptions/AllTests.cpp @@ -14,6 +14,12 @@ using namespace std; using namespace Test; +namespace +{ +const bool printException = false; +} + + class EmptyI : virtual public Empty { }; @@ -482,8 +488,13 @@ allTests(const Ice::CommunicatorPtr& communicator) first = communicator->createObjectAdapter("TestAdapter0"); test(false); } - catch(const Ice::InitializationException&) + catch(const Ice::InitializationException& ex) { + if(printException) + { + Ice::Print printer(communicator->getLogger()); + printer << ex; + } // Expected } @@ -494,8 +505,14 @@ allTests(const Ice::CommunicatorPtr& communicator) Ice::ObjectAdapterPtr second = communicator->createObjectAdapter("TestAdapter0"); test(false); } - catch(const Ice::AlreadyRegisteredException&) + catch(const Ice::AlreadyRegisteredException& ex) { + if(printException) + { + Ice::Print printer(communicator->getLogger()); + printer << ex; + } + // Expected } @@ -505,8 +522,14 @@ allTests(const Ice::CommunicatorPtr& communicator) communicator->createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011"); test(false); } - catch(const Ice::AlreadyRegisteredException&) + catch(const Ice::AlreadyRegisteredException& ex) { + if(printException) + { + Ice::Print printer(communicator->getLogger()); + printer << ex; + } + // Expected. } first->deactivate(); @@ -524,8 +547,13 @@ allTests(const Ice::CommunicatorPtr& communicator) adapter->add(obj, communicator->stringToIdentity("x")); test(false); } - catch(const Ice::AlreadyRegisteredException&) + catch(const Ice::AlreadyRegisteredException& ex) { + if(printException) + { + Ice::Print printer(communicator->getLogger()); + printer << ex; + } } try @@ -535,14 +563,24 @@ allTests(const Ice::CommunicatorPtr& communicator) catch(const Ice::IllegalIdentityException& ex) { test(ex.id.name == ""); + if(printException) + { + Ice::Print printer(communicator->getLogger()); + printer << ex; + } } try { adapter->add(0, communicator->stringToIdentity("x")); } - catch(const Ice::IllegalServantException&) + catch(const Ice::IllegalServantException& ex) { + if(printException) + { + Ice::Print printer(communicator->getLogger()); + printer << ex; + } } @@ -552,8 +590,13 @@ allTests(const Ice::CommunicatorPtr& communicator) adapter->remove(communicator->stringToIdentity("x")); test(false); } - catch(const Ice::NotRegisteredException&) + catch(const Ice::NotRegisteredException& ex) { + if(printException) + { + Ice::Print printer(communicator->getLogger()); + printer << ex; + } } adapter->deactivate(); |