Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / tests / Bug_2085_Regression / Bug_2085_Regression.cpp
blobf3b953d440c9e3c1e4a10da47e9d43c424a7d590
2 #include "ace/Task.h"
3 #include "ace/Auto_Event.h"
4 #include "tao/ORB.h"
5 #include "tao/Object.h"
6 #include "tao/SystemException.h"
8 bool
9 test_string_to_object (CORBA::ORB_ptr orb, const char* ior, CORBA::ULong minor)
11 bool succeed = false;
12 try
14 // Get the object reference with the IOR
15 CORBA::Object_var object = orb->string_to_object (ior);
17 catch (const CORBA::BAD_PARAM& ex)
19 if ((ex.minor() & 0xFFFU) == minor)
21 succeed = true;
24 catch (const CORBA::Exception&)
28 if (!succeed)
30 ACE_ERROR ((LM_ERROR,
31 "(%t) ERROR, test_string_to_object for <%C> didn't result in minor code %d\n",
32 ior,
33 minor));
36 return succeed;
39 int
40 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
42 int retval = 0;
44 try
46 CORBA::ORB_var orb =
47 CORBA::ORB_init (argc, argv);
49 // string_to_object conversion failed due to bad scheme name
50 if (!test_string_to_object (orb.in (), "", 7))
51 ++retval;
52 // string_to_object conversion failed due to bad address
53 if (!test_string_to_object (orb.in (), "", 8))
54 ++retval;
55 // string_to_object conversion failed due to bad bad schema specific part
56 if (!test_string_to_object (orb.in (), "", 9))
57 ++retval;
58 // string_to_object conversion failed due to non specific reason
59 if (!test_string_to_object (orb.in (), "", 10))
60 ++retval;
62 orb->destroy ();
64 ACE_DEBUG ((LM_DEBUG,
65 "%s successful\n",
66 argv[0]));
68 catch (const CORBA::Exception& ex)
70 ex._tao_print_exception ("Exception caught");
71 retval = -1;
74 return retval;