diff --git a/tao/x11/pi/client_request_info.cpp b/tao/x11/pi/client_request_info.cpp index 946266bb..7e8e3e90 100644 --- a/tao/x11/pi/client_request_info.cpp +++ b/tao/x11/pi/client_request_info.cpp @@ -75,11 +75,8 @@ namespace TAOX11_NAMESPACE IOP::TaggedProfile rc {}; try { - TAO_IOP::TaggedProfile_var tao_tp = - this->reqinf_->effective_profile (); - rc = IOP::TaggedProfile ( - tao_tp->tag, - seq_to_x11 (tao_tp->profile_data)); + TAO_IOP::TaggedProfile_var tao_tp = this->reqinf_->effective_profile (); + rc = IOP::TaggedProfile (tao_tp->tag, seq_to_x11 (tao_tp->profile_data)); } catch_tao_system_ex (_sx) return rc; diff --git a/tests/pi/current/client.cpp b/tests/pi/current/client.cpp index 3f309ab9..fa5a2520 100644 --- a/tests/pi/current/client.cpp +++ b/tests/pi/current/client.cpp @@ -74,8 +74,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) server->invoke_me (); - CORBA::Any new_data = - pi_current->get_slot (::slot_id); + CORBA::Any new_data = pi_current->get_slot (::slot_id); // The original data in the TSC was of type uint32_t. If the // following extraction from the CORBA::Any fails, then the @@ -96,6 +95,15 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) server->invoke_we (); + try + { + server->test_exception (); + } + catch (const PICurrentTest::bar&) + { + TAOX11_TEST_INFO << "Caught correct exception" << std::endl; + } + server->shutdown (); std::this_thread::sleep_for (std::chrono::seconds (1)); diff --git a/tests/pi/current/client_request_interceptor.cpp b/tests/pi/current/client_request_interceptor.cpp index 1566bc74..a05adfc8 100644 --- a/tests/pi/current/client_request_interceptor.cpp +++ b/tests/pi/current/client_request_interceptor.cpp @@ -127,8 +127,20 @@ ClientRequestInterceptor::receive_reply ( void ClientRequestInterceptor::receive_exception ( - IDL::traits::ref_type) + IDL::traits::ref_type ri) { + TAOX11_TEST_INFO << "ClientRequestInterceptor::receive_exception (" << ri->operation () << ") with id " << ri->request_id () << std::endl; + + std::string const op = ri->operation (); + + if (op == "test_exception") + { + TAOX11_TEST_INFO << "ClientRequestInterceptor::receive_exception, exception: (" << ri->received_exception () << ") id: (" << ri->received_exception_id () << ")" << std::endl; + } + else + { + TAOX11_TEST_ERROR << "ClientRequestInterceptor::receive_exception called for operation " << op << std::endl; + } } void diff --git a/tests/pi/current/server_request_interceptor.cpp b/tests/pi/current/server_request_interceptor.cpp index ee4ce403..99505e8b 100644 --- a/tests/pi/current/server_request_interceptor.cpp +++ b/tests/pi/current/server_request_interceptor.cpp @@ -185,15 +185,26 @@ ServerRequestInterceptor::send_reply ( throw CORBA::INTERNAL (); } - TAOX11_TEST_INFO << "Server side RSC/TSC semantics appear " \ "to be correct." << std::endl; } void ServerRequestInterceptor::send_exception ( - IDL::traits::ref_type) + IDL::traits::ref_type ri) { + TAOX11_TEST_INFO << "ServerRequestInterceptor::send_exception (" << ri->operation () << ")" << std::endl; + + std::string const op = ri->operation (); + + if (op == "test_exception") + { + TAOX11_TEST_INFO << "ServerRequestInterceptor::send_exception, exception: (" << ri->sending_exception () << ")" << std::endl; + } + else + { + TAOX11_TEST_ERROR << "ServerRequestInterceptor::send_exception called for operation " << op << std::endl; + } } void diff --git a/tests/pi/current/test.idl b/tests/pi/current/test.idl index 96a2efd8..67c33fcd 100644 --- a/tests/pi/current/test.idl +++ b/tests/pi/current/test.idl @@ -11,6 +11,9 @@ module PICurrentTest { + exception bar + { + }; interface test { @@ -20,6 +23,8 @@ module PICurrentTest void invoke_we (); + void test_exception () raises (bar); + oneway void shutdown (); }; diff --git a/tests/pi/current/test_i.cpp b/tests/pi/current/test_i.cpp index 45dce09f..451793d7 100644 --- a/tests/pi/current/test_i.cpp +++ b/tests/pi/current/test_i.cpp @@ -118,7 +118,6 @@ test_i::invoke_you () { // Nothing to be tested here. This method is here just so that we // have a different method - TAOX11_TEST_INFO << "test_i::invoke_you method invoked." << std::endl; } @@ -128,7 +127,7 @@ test_i::invoke_we () TAOX11_TEST_INFO << "test_i::invoke_we method invoked." << std::endl; // Insert some data into the TSC PICurrent object. - const std::string str = "We drink milk!"; + std::string const str = "We drink milk!"; CORBA::Any data; @@ -158,3 +157,11 @@ test_i::shutdown () this->orb_->shutdown (false); } + +void +test_i::test_exception () +{ + TAOX11_TEST_INFO << "test_exception." << std::endl; + + throw PICurrentTest::bar (); +} diff --git a/tests/pi/current/test_i.h b/tests/pi/current/test_i.h index b2af4749..3cbb563d 100644 --- a/tests/pi/current/test_i.h +++ b/tests/pi/current/test_i.h @@ -46,6 +46,9 @@ class test_i final : /// Shutdown the ORB. void shutdown () override; + /// Test exceptions + void test_exception () override; + private: /// Reference to the PICurrent object. IDL::traits::ref_type current_;