Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tests / COIOP / Client_Task.cpp
blobeca3d47e0bdc65962296aee8573dbd3d8b791ee1
1 // -*- C++ -*-
2 #include "Client_Task.h"
3 #include "tao/ORB_Core.h"
4 #include "TestC.h"
6 Client_Task::Client_Task (const ACE_TCHAR *ior,
7 CORBA::ORB_ptr corb,
8 ACE_Thread_Manager *thr_mgr,
9 CORBA::Boolean result)
10 : ACE_Task_Base (thr_mgr)
11 , input_ (ior)
12 , corb_ (CORBA::ORB::_duplicate (corb))
13 , result_ (result)
17 int
18 Client_Task::svc ()
20 try
22 CORBA::Object_var tmp =
23 this->corb_->string_to_object (input_);
25 Test::Hello_var hello =
26 Test::Hello::_narrow(tmp.in ());
28 if (CORBA::is_nil (hello.in ()))
30 ACE_ERROR_RETURN ((LM_DEBUG,
31 "Nil Test::Hello reference <%s>\n",
32 input_),
33 1);
36 CORBA::String_var the_string =
37 hello->get_string ();
39 ACE_DEBUG ((LM_DEBUG,
40 "(%P|%t) - string returned <%C>\n",
41 the_string.in ()));
43 if (!this->result_)
45 // We would expect the call to fail, so we have an error now
46 ACE_ERROR ((LM_ERROR, "(%P|%t) - ERROR: get_string should have failed\n"));
49 hello->shutdown ();
51 catch (const CORBA::TRANSIENT& ex)
53 if (!this->result_)
55 ACE_DEBUG ((LM_DEBUG, "(%P|%t) - caught expected exception\n"));
56 // When collocation has been disabled we expect a transient
57 // with minor code 2
58 return 0;
61 ex._tao_print_exception ("Caught exception:");
62 return 1;
64 catch (const CORBA::Exception& ex)
66 ex._tao_print_exception ("Exception caught:");
67 return 1;
70 return 0;