summaryrefslogtreecommitdiff
path: root/trunk/TAO/tests/Bug_2503_Regression/common.cpp
blob: e39b801da7b196f27b6f2d919d06f34e45a6a0bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// $Id$

#include "common.h"
#include "tao/PortableServer/PortableServer.h"

CORBA::ORB_ptr
initialize_orb_and_poa(int & argc, char * argv[])
{
  CORBA::ORB_var orb =
    CORBA::ORB_init (argc, argv);

  CORBA::Object_var poa_object =
    orb->resolve_initial_references("RootPOA");

  PortableServer::POA_var root_poa =
    PortableServer::POA::_narrow (poa_object.in ());

  PortableServer::POAManager_var poa_manager =
    root_poa->the_POAManager ();

  poa_manager->activate ();

  return orb._retn();
}

void report_exception()
{
  try
  {
    throw;
  }
  catch(CORBA::Exception & ex)
  {
    ex._tao_print_exception ("CORBA Exception raised:");
  }
  catch(char const * msg)
  {
    ACE_ERROR ((LM_ERROR, "Exception (char const*) raised: %s\n",
            msg));
  }
  catch(...)
  {
    ACE_ERROR ((LM_ERROR, "Unknown exception raised\n"));
  }
}