summaryrefslogtreecommitdiff
path: root/tests/Portable_Interceptors/AdvSlot
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Portable_Interceptors/AdvSlot')
-rw-r--r--tests/Portable_Interceptors/AdvSlot/client.cpp30
-rw-r--r--tests/Portable_Interceptors/AdvSlot/server.cpp83
2 files changed, 65 insertions, 48 deletions
diff --git a/tests/Portable_Interceptors/AdvSlot/client.cpp b/tests/Portable_Interceptors/AdvSlot/client.cpp
index 9dde6c00f21..0feb40d7b44 100644
--- a/tests/Portable_Interceptors/AdvSlot/client.cpp
+++ b/tests/Portable_Interceptors/AdvSlot/client.cpp
@@ -6,22 +6,30 @@
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
- CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+ try
+ {
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
- if (argc != 2)
- {
- ACE_DEBUG ((LM_ERROR, "Usage: %s <ior>\n", argv[0]));
- return -1;
- }
+ if (argc != 2)
+ {
+ ACE_DEBUG ((LM_ERROR, "Usage: %s <ior>\n", argv[0]));
+ return -1;
+ }
- CORBA::Object_var obj = orb->string_to_object (argv[1]);
- StateTransfer_var server = StateTransfer::_narrow (obj.in ());
+ CORBA::Object_var obj = orb->string_to_object (argv[1]);
+ StateTransfer_var server = StateTransfer::_narrow (obj.in ());
- CORBA::Short n = server->number ();
+ CORBA::Short n = server->number ();
- ACE_DEBUG ((LM_ERROR, "Got number %d\n", n));
+ ACE_DEBUG ((LM_ERROR, "Got number %d\n", n));
- server->shutdown ();
+ server->shutdown ();
+ }
+ catch (const ::CORBA::Exception &ex)
+ {
+ ex._tao_print_exception ("ERROR : unexpected CORBA exception caught : ");
+ return 1;
+ }
return 0;
}
diff --git a/tests/Portable_Interceptors/AdvSlot/server.cpp b/tests/Portable_Interceptors/AdvSlot/server.cpp
index 007d6fca674..87978761ff6 100644
--- a/tests/Portable_Interceptors/AdvSlot/server.cpp
+++ b/tests/Portable_Interceptors/AdvSlot/server.cpp
@@ -177,59 +177,68 @@ public:
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
- ORBInitializer_var orb_initializer (new ORB_Initializer ());
- register_orb_initializer (orb_initializer.in ());
+ try
+ {
+ ORBInitializer_var orb_initializer (new ORB_Initializer ());
+ register_orb_initializer (orb_initializer.in ());
- ORB_var orb (ORB_init (argc, argv));
+ ORB_var orb (ORB_init (argc, argv));
- if (parse_args (argc, argv) != 0)
- return 1;
+ if (parse_args (argc, argv) != 0)
+ return 1;
- Object_var obj (orb->resolve_initial_references ("RootPOA"));
+ Object_var obj (orb->resolve_initial_references ("RootPOA"));
- POA_var root_poa (POA::_narrow (obj.in ()));
- POAManager_var poa_manager (root_poa->the_POAManager ());
+ POA_var root_poa (POA::_narrow (obj.in ()));
+ POAManager_var poa_manager (root_poa->the_POAManager ());
- StateTransferImpl* impl = new StateTransferImpl (orb.in ());
- ServantBase_var impl_var (impl);
+ StateTransferImpl* impl = new StateTransferImpl (orb.in ());
+ ServantBase_var impl_var (impl);
- PortableServer::ObjectId_var id_act =
- root_poa->activate_object (impl);
+ PortableServer::ObjectId_var id_act =
+ root_poa->activate_object (impl);
- CORBA::Object_var object = root_poa->id_to_reference (id_act.in ());
+ CORBA::Object_var object = root_poa->id_to_reference (id_act.in ());
- StateTransfer_var ref = StateTransfer::_narrow (object.in ());
- String_var ior (orb->object_to_string (ref.in ()));
+ StateTransfer_var ref = StateTransfer::_narrow (object.in ());
+ String_var ior (orb->object_to_string (ref.in ()));
- poa_manager->activate ();
+ poa_manager->activate ();
- // Dump the ior.
- //
- FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
- if (output_file == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "Cannot open output file <%s> for writing "
- "IOR: %C",
- ior_output_file,
- ior.in ()),
- 1);
- }
+ // Dump the ior.
+ //
+ FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
+ if (output_file == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot open output file <%s> for writing "
+ "IOR: %C",
+ ior_output_file,
+ ior.in ()),
+ 1);
+ }
+
+ ACE_OS::fprintf (output_file, "%s", ior.in ());
+ ACE_OS::fclose (output_file);
- ACE_OS::fprintf (output_file, "%s", ior.in ());
- ACE_OS::fclose (output_file);
+ ACE_DEBUG ((LM_DEBUG, "Server is ready, IOR is in '%s'\n", ior_output_file));
- ACE_DEBUG ((LM_DEBUG, "Server is ready, IOR is in '%s'\n", ior_output_file));
+ // Run the ORB event loop.
+ //
+ orb->run ();
- // Run the ORB event loop.
- //
- orb->run ();
+ root_poa->destroy (1, 1);
+ orb->destroy ();
- root_poa->destroy (1, 1);
- orb->destroy ();
+ ACE_DEBUG ((LM_DEBUG, "Event loop finished.\n"));
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Caught unexpected CORBA exception:");
- ACE_DEBUG ((LM_DEBUG, "Event loop finished.\n"));
+ return 1;
+ }
return 0;
}