1 #include "tao/SystemException.h"
2 #include "tao/ORB_Constants.h"
3 #include "tao/CORBA_String.h"
6 #include "tao/AnyTypeCode_Adapter.h"
8 #include "ace/Malloc.h"
9 #include "ace/SString.h"
10 #include "ace/OS_NS_string.h"
11 #include "ace/OS_NS_stdio.h"
12 #include "ace/Dynamic_Service.h"
14 #if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
15 // Needed for ostream& operator<< (ostream &os, const CORBA::Exception &e)
16 // FUZZ: disable check_for_streams_include
17 #include "ace/streams.h"
18 #endif /* (ACE_LACKS_IOSTREAM_TOTALLY) */
20 #if !defined (__ACE_INLINE__)
21 # include "tao/SystemException.inl"
22 #endif /* __ACE_INLINE__ */
24 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
27 * @name @c errno Encoding
29 * The @c errno encoding is located in the bottom 7 bits.
32 const CORBA::ULong TAO_UNSPECIFIED_MINOR_CODE
= 0x0U
;
33 const CORBA::ULong TAO_ETIMEDOUT_MINOR_CODE
= 0x1U
;
34 const CORBA::ULong TAO_ENFILE_MINOR_CODE
= 0x2U
;
35 const CORBA::ULong TAO_EMFILE_MINOR_CODE
= 0x3U
;
36 const CORBA::ULong TAO_EPIPE_MINOR_CODE
= 0x4U
;
37 const CORBA::ULong TAO_ECONNREFUSED_MINOR_CODE
= 0x5U
;
38 const CORBA::ULong TAO_ENOENT_MINOR_CODE
= 0x6U
;
39 const CORBA::ULong TAO_EBADF_MINOR_CODE
= 0x7U
;
40 const CORBA::ULong TAO_ENOSYS_MINOR_CODE
= 0x8U
;
41 const CORBA::ULong TAO_EPERM_MINOR_CODE
= 0x9U
;
42 const CORBA::ULong TAO_EAFNOSUPPORT_MINOR_CODE
= 0xAU
;
43 const CORBA::ULong TAO_EAGAIN_MINOR_CODE
= 0xBU
;
44 const CORBA::ULong TAO_ENOMEM_MINOR_CODE
= 0xCU
;
45 const CORBA::ULong TAO_EACCES_MINOR_CODE
= 0xDU
;
46 const CORBA::ULong TAO_EFAULT_MINOR_CODE
= 0xEU
;
47 const CORBA::ULong TAO_EBUSY_MINOR_CODE
= 0xFU
;
48 const CORBA::ULong TAO_EEXIST_MINOR_CODE
= 0x10U
;
49 const CORBA::ULong TAO_EINVAL_MINOR_CODE
= 0x11U
;
50 const CORBA::ULong TAO_ECOMM_MINOR_CODE
= 0x12U
;
51 const CORBA::ULong TAO_ECONNRESET_MINOR_CODE
= 0x13U
;
52 const CORBA::ULong TAO_ENOTSUP_MINOR_CODE
= 0x14U
;
53 // *Don't* use TAO_<errno>_MINOR_CODE greater than 0x7FU!
56 // ****************************************************************
58 CORBA::SystemException::SystemException ()
60 completed_ (CORBA::COMPLETED_NO
)
64 CORBA::SystemException::SystemException (const char *repository_id
,
65 const char *local_name
,
67 CORBA::CompletionStatus completed
)
68 : CORBA::Exception (repository_id
,
71 completed_ (completed
)
75 CORBA::SystemException::SystemException (CORBA::ULong code
,
76 CORBA::CompletionStatus completed
)
78 completed_ (completed
)
82 CORBA::SystemException::SystemException (const CORBA::SystemException
&src
)
83 : CORBA::Exception (src
),
85 completed_ (src
.completed_
)
89 CORBA::SystemException
&
90 CORBA::SystemException::operator= (const CORBA::SystemException
&src
)
94 this->Exception::operator= (src
);
96 this->minor_
= src
.minor_
;
97 this->completed_
= src
.completed_
;
104 CORBA::SystemException::_tao_encode (TAO_OutputCDR
&cdr
) const
106 if (cdr
.write_string (this->_rep_id ())
107 && cdr
.write_ulong (this->minor ())
108 && cdr
.write_ulong (this->completed ()))
113 throw ::CORBA::MARSHAL ();
117 CORBA::SystemException::_tao_decode (TAO_InputCDR
&cdr
)
119 // The string is read by the caller, to determine the exact type of
120 // the exception. We just decode the fields...
121 // cdr.read_string (this->id ());
124 if (cdr
.read_ulong (this->minor_
)
125 && cdr
.read_ulong (tmp
))
127 this->completed_
= CORBA::CompletionStatus (tmp
);
131 throw ::CORBA::MARSHAL ();
135 CORBA::SystemException::_tao_errno (int errno_value
)
140 return TAO_UNSPECIFIED_MINOR_CODE
;
142 return TAO_ETIMEDOUT_MINOR_CODE
;
144 return TAO_ENFILE_MINOR_CODE
;
146 return TAO_EPIPE_MINOR_CODE
;
148 return TAO_ECONNREFUSED_MINOR_CODE
;
150 return TAO_ENOENT_MINOR_CODE
;
152 return TAO_EMFILE_MINOR_CODE
;
154 return TAO_EBADF_MINOR_CODE
;
156 return TAO_EPERM_MINOR_CODE
;
158 return TAO_EINVAL_MINOR_CODE
;
159 #if (ENOSYS != EFAULT)
161 return TAO_ENOSYS_MINOR_CODE
;
162 #endif /* ENOSYS != EFAULT */
164 return TAO_EAFNOSUPPORT_MINOR_CODE
;
166 return TAO_EAGAIN_MINOR_CODE
;
168 return TAO_ENOMEM_MINOR_CODE
;
170 return TAO_EACCES_MINOR_CODE
;
172 return TAO_EFAULT_MINOR_CODE
;
174 return TAO_EBUSY_MINOR_CODE
;
176 return TAO_EEXIST_MINOR_CODE
;
178 return TAO_ECOMM_MINOR_CODE
;
180 return TAO_ECONNRESET_MINOR_CODE
;
181 #if (ENOTSUP != ENOSYS)
183 return TAO_ENOTSUP_MINOR_CODE
;
184 #endif /* ENOSYS != EFAULT */
186 // Mask off bottom 7 bits and return them.
187 return errno_value
& 0x7FU
;
192 CORBA::SystemException::_tao_duplicate () const
198 CORBA::SystemException::_tao_minor_code (u_int location
, int errno_value
)
203 | _tao_errno (errno_value
);
207 CORBA::SystemException::_tao_print_system_exception (FILE *) const
209 TAOLIB_ERROR ((LM_ERROR
,
210 ACE_TEXT("(%P|%t) system exception, ID '%C'\n"),
211 this->_info ().c_str ()));
215 CORBA::SystemException::_info () const
217 // @@ there are a few other "user exceptions" in the CORBA scope,
218 // they're not all standard/system exceptions ... really need to
219 // either compare exhaustively against all those IDs (yeech) or
220 // (preferably) to represent the exception type directly in the
221 // exception value so it can be queried.
223 ACE_CString info
= "system exception, ID '";
224 info
+= this->_rep_id ();
225 #if defined (TAO_SUPPRESS_NEW_LINE_IN_EXCEPTION_LOGGING)
231 CORBA::ULong
const VMCID
= this->minor () & 0xFFFFF000u
;
233 if (VMCID
== TAO::VMCID
)
235 // @@ Move the following code to a subroutine, it is too long already!
236 const char *location
= nullptr;
237 switch (this->minor () & 0x00000F80u
)
239 case TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE
:
240 location
= "location forward failed";
242 case TAO_INVOCATION_SEND_REQUEST_MINOR_CODE
:
243 location
= "send request failed";
245 case TAO_POA_DISCARDING
:
246 location
= "poa in discarding state";
248 case TAO_POA_HOLDING
:
249 location
= "poa in holding state";
251 case TAO_POA_INACTIVE
:
252 location
= "poa in inactive state";
254 case TAO_UNHANDLED_SERVER_CXX_EXCEPTION
:
255 location
= "unhandled c++ exception in server side";
257 case TAO_INVOCATION_RECV_REQUEST_MINOR_CODE
:
258 location
= "failed to recv request response";
260 case TAO_CONNECTOR_REGISTRY_NO_USABLE_PROTOCOL
:
261 location
= "all protocols failed to parse the IOR";
263 case TAO_MPROFILE_CREATION_ERROR
:
264 location
= "error during MProfile creation";
266 case TAO_TIMEOUT_CONNECT_MINOR_CODE
:
267 location
= "timeout during connect";
269 case TAO_TIMEOUT_SEND_MINOR_CODE
:
270 location
= "timeout during send";
272 case TAO_TIMEOUT_RECV_MINOR_CODE
:
273 location
= "timeout during recv";
275 case TAO_IMPLREPO_MINOR_CODE
:
276 location
= "implrepo server exception";
278 case TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE
:
279 location
= "endpoint initialization failure in Acceptor Registry";
281 case TAO_ORB_CORE_INIT_LOCATION_CODE
:
282 location
= "ORB Core initialization failed";
284 case TAO_POLICY_NARROW_CODE
:
285 location
= "Failure when narrowing a Policy";
287 case TAO_GUARD_FAILURE
:
288 location
= "Failure when trying to acquire a guard/monitor";
290 case TAO_POA_BEING_DESTROYED
:
291 location
= "POA has been destroyed or is currently being destroyed";
293 case TAO_AMH_REPLY_LOCATION_CODE
:
294 location
= "Failure when trying to send AMH reply";
296 case TAO_RTCORBA_THREAD_CREATION_LOCATION_CODE
:
297 location
= "Failure in thread creation for RTCORBA thread pool";
300 location
= "unknown location";
303 const char *errno_indication
= nullptr;
304 char unknown_errno
[255];
305 CORBA::ULong minor_code
= this->minor () & 0x7FU
;
308 case TAO_UNSPECIFIED_MINOR_CODE
:
309 errno_indication
= "unspecified errno";
311 case TAO_ETIMEDOUT_MINOR_CODE
:
312 errno_indication
= "ETIMEOUT";
314 case TAO_ENFILE_MINOR_CODE
:
315 errno_indication
= "ENFILE";
317 case TAO_EMFILE_MINOR_CODE
:
318 errno_indication
= "EMFILE";
320 case TAO_EPIPE_MINOR_CODE
:
321 errno_indication
= "EPIPE";
323 case TAO_ECONNREFUSED_MINOR_CODE
:
324 errno_indication
= "ECONNREFUSED";
326 case TAO_ENOENT_MINOR_CODE
:
327 errno_indication
= "ENOENT";
329 case TAO_EBADF_MINOR_CODE
:
330 errno_indication
= "EBADF";
332 case TAO_ENOSYS_MINOR_CODE
:
333 errno_indication
= "ENOSYS";
335 case TAO_EPERM_MINOR_CODE
:
336 errno_indication
= "EPERM";
338 case TAO_EAFNOSUPPORT_MINOR_CODE
:
339 errno_indication
= "EAFNOSUPPORT";
341 case TAO_EAGAIN_MINOR_CODE
:
342 errno_indication
= "EAGAIN";
344 case TAO_ENOMEM_MINOR_CODE
:
345 errno_indication
= "ENOMEM";
347 case TAO_EACCES_MINOR_CODE
:
348 errno_indication
= "EACCES";
350 case TAO_EFAULT_MINOR_CODE
:
351 errno_indication
= "EFAULT";
353 case TAO_EBUSY_MINOR_CODE
:
354 errno_indication
= "EBUSY";
356 case TAO_EEXIST_MINOR_CODE
:
357 errno_indication
= "EEXIST";
359 case TAO_EINVAL_MINOR_CODE
:
360 errno_indication
= "EINVAL";
362 case TAO_ECOMM_MINOR_CODE
:
363 errno_indication
= "ECOMM";
365 case TAO_ECONNRESET_MINOR_CODE
:
366 errno_indication
= "ECONNRESET";
368 case TAO_ENOTSUP_MINOR_CODE
:
369 errno_indication
= "ENOTSUP";
373 // 7 bits of some other errno.
374 ACE_OS::sprintf (unknown_errno
,
375 "low 7 bits of errno: %3u %s",
376 minor_code
, ACE_OS::strerror (minor_code
));
378 errno_indication
= unknown_errno
;
383 ACE_OS::sprintf (buffer
,
385 "minor code = %x (%s; %s), "
386 #if defined (TAO_SUPPRESS_NEW_LINE_IN_EXCEPTION_LOGGING)
394 (completed () == CORBA::COMPLETED_YES
) ? "YES" :
395 (completed () == CORBA::COMPLETED_NO
) ? "NO" :
396 (completed () == CORBA::COMPLETED_MAYBE
) ? "MAYBE" :
401 else if (VMCID
== CORBA::OMGVMCID
)
403 CORBA::ULong
const minor_code
= this->minor () & 0xFFFU
;
405 const char *minor_description
= nullptr;
409 CORBA::SystemException::_tao_get_omg_exception_description (
413 minor_description
= "*unknown description*";
416 ACE_OS::sprintf (buffer
,
417 "OMG minor code (%d), "
418 "described as '%s', "
419 #if defined (TAO_SUPPRESS_NEW_LINE_IN_EXCEPTION_LOGGING)
426 (completed () == CORBA::COMPLETED_YES
) ? "YES" :
427 (completed () == CORBA::COMPLETED_NO
) ? "NO" :
428 (completed () == CORBA::COMPLETED_MAYBE
) ? "MAYBE" :
436 ACE_OS::sprintf (buffer
,
437 "Unknown vendor minor code id (%x), "
438 #if defined (TAO_SUPPRESS_NEW_LINE_IN_EXCEPTION_LOGGING)
439 "minor code = %x, completed = %s; ",
441 "minor code = %x, completed = %s\n",
444 this->minor (), // Use the raw minor code
445 (completed () == CORBA::COMPLETED_YES
) ? "YES" :
446 (completed () == CORBA::COMPLETED_NO
) ? "NO" :
447 (completed () == CORBA::COMPLETED_MAYBE
) ? "MAYBE" :
457 CORBA::SystemException::_tao_get_omg_exception_description (
458 const CORBA::SystemException
&exc
,
459 CORBA::ULong minor_code
)
463 static const char *UNKNOWN_TABLE
[] =
465 "Unlisted user exception received by client.", // 1
466 "Non-standard SystemException not supported.", // 2
467 "An unknown user exception received by a portable interceptor." // 3
470 static const char *BAD_PARAM_TABLE
[] =
472 "Failure to register, unregister, or lookup value factory.", // 1
473 "RID already defined in IFR.", // 2
474 "Name already used in the context in IFR.", // 3
475 "Target is not a valid container.", // 4
476 "Name clash in inherited context.", // 5
477 "Incorrect type for abstract interface.", // 6
478 "string_to_object conversion failed due to a bad scheme name.", // 7
479 "string_to_object conversion failed due to a bad address.", // 8
480 "string_to_object conversion failed due to a bad schema specific part.",// 9
481 "string_to_object conversion failed due to non specific reason.", // 10
482 "Attempt to derive abstract interface from non-abstract base interface in the Interface Repository.", // 11
483 "Attempt to let a ValueDef support more than one non-abstract interface in the Interface Repository.", // 12
484 "Attempt to use an incomplete TypeCode as a parameter.", // 13
485 "Invalid object id passed to POA::create_reference_by_id.", // 14
486 "Bad name argument in TypeCode operation.", // 15
487 "Bad RepositoryId argument in TypeCode operation.", // 16
488 "Invalid member name in TypeCode operation.", // 17
489 "Duplicate label value in create_union_tc.", // 18
490 "Incompatible TypeCode of label and discriminator in create_union_tc.", // 19
491 "Supplied discriminator type illegitimate in create_union_tc.", // 20
492 "Any passed to ServerRequest::set_exception does not contain an exception.", // 21
493 "Unlisted user exception passed to ServerRequest::set_exception", // 22
494 "wchar transmission code set not in service context.", // 23
495 "Service context is not in OMG-defined range.", // 24
496 "Enum value out of range.", // 25
497 "Invalid service context Id in portable interceptor.", // 26
498 "Attempt to call register_initial_reference with a null Object.", // 27
499 "Invalid component Id in portable interceptor.", // 28
500 "Invalid profile Id in portable interceptor.", // 29
501 "Two or more Policy objects with the same PolicyType value supplied to Object::set_policy_overrides or PolicyManager::set_policy_overrides.", // 30
502 "Attempt to define a oneway operation with non-void result, out or inout parameters or user exceptions.", // 31
503 "DII asked to create request for an implicit operation.", // 32,
504 "An OTS/XA integration xa_ call returned XAER_INVAL.", // 33
505 "Union branch modifier called with bad case label discriminator.", // 34
506 "Illegal IDL context property name.", // 35
507 "Illegal IDL property search string.", // 36
508 "Illegal IDL context name.", // 37
509 "Non-empty IDL context.", // 38
510 "Unsupported RMI/IDL customer value type stream format.", // 39
511 "ORB output stream does not support ValueOutputStream interface.", // 40
512 "ORB input stream does not support ValueInputStream interface.", // 41
513 "Character support limited to ISO 8859-1 for this object reference", // 42
514 "Attempt to add a Pollable to a second PollableSet." // 43
517 static const char *IMP_LIMIT_TABLE
[] =
519 "Unable to use any profile in IOR." // 1
522 static const char *INITIALIZE_TABLE
[] =
524 "Priority range too restricted for ORB." // 1
528 static const char *INV_OBJREF_TABLE
[] =
530 "wchar Code Set support not specified.", // 1
531 "Codeset component required for type using wchar or wstring data." // 2
534 static const char *MARSHAL_TABLE
[] =
536 "Unable to locate value factory.", // 1
537 "ServerRequest::set_result called before ServerRequest::ctx when the operation IDL contains a context clause.", // 2
538 "NVList passed to ServerRequest::arguments does not describe all parameters passed by client.", // 3
539 "Attempt to marshal Local object.", // 4
540 "wchar or wstring data erroneously sent by client over GIOP 1.0 connection.", // 5
541 "wchar or wstring data erroneously returned by server over GIOP 1.0 connection.", //6
542 "Unsupported RMI/IDL custom value type stream format.", // 7
543 "Custom data not compatible with ValueHandler read operation.", // 8
544 "Codeset service contexts with different values received on the same connection." // 9
548 static const char *BAD_TYPECODE_TABLE
[] =
550 "Attempt to marshal incomplete TypeCode.", // 1
551 "Member type code illegitimate in TypeCode operation.", // 2
552 "Illegal parameter type." // 3
555 static const char *NO_IMPLEMENT_TABLE
[] =
557 "Missing local value implementation.", // 1
558 "Incompatible value implementation version.", // 2
559 "Unable to use any profile in IOR.", // 3
560 "Attempt to use DII on Local object.", // 4
561 "Biomolecular Sequence Analysis iterator cannot be reset.", // 5
562 "Biomolecular Sequence Analysis metadata is not available as XML.", // 6
563 "Genomic Maps iterator cannot be rest.", // 7
564 "Operation not implemented in local object" // 8
567 static const char *NO_RESOURCES_TABLE
[] =
569 "Portable Interceptor operation not support in this binding.", // 1
570 "No connection for request's priority." // 2
573 static const char *BAD_INV_ORDER_TABLE
[] =
575 "Dependency exists in IFR preventing destruction of this object", // 1
576 "Attempt to destroy indestructible objects in IFR.", // 2
577 "Operation would deadlock.", // 3
578 "ORB has shutdown.", // 4
579 "Attempt to invoke \"send\" or \"invoke\" operation of the same \"Request\" object more than once.", // 5
580 "Attempt to set a servant manager after one has already been set.", // 6
581 "ServerRequest::arguments called more than once or after a call to ServerRequest::set_exception.", // 7
582 "ServerRequest::ctx called more than once or before ServerRequest::arguments or after ServerRequest::ctx, ServerRequest::set_result or ServerRequest::set_exception.", // 8
583 "ServerRequest::set_result called more than once or before ServerRequest::arguments or after ServerRequest::set_result or ServerRequest::set_exception.", // 9
584 "Attempt to send a DII request after it was sent previously.", // 10
585 "Attempt to poll a DII request or to retrieve its result before the request was sent.", // 11
586 "Attempt to poll a DII request or to retrieve its result after the result was retrieved previously.", // 12
587 "Attempt to poll a synchronous DII request or to retrieve results from a synchronous DII request.", // 13
588 "Invalid portable interceptor call", // 14
589 "Service context add failed in portable interceptor because a service context with the given id already exists.", // 15
590 "Registration of PolicyFactory failed because a factory already exists for the given type.", // 16
591 "POA cannot create POAs while undergoing destruction.", // 17
592 "Attempt to reassign priority.", // 18
593 "An OTS/XA integration xa_start call returned XAER_OUTSIDE.", // 19
594 "An OTS/XA integration xa_call returned XAER_PROTO.", // 20
595 "Transaction context of request & client threads do not match in interceptor.", // 21
596 "Poller has not returned any response yet.", // 22
597 "Registration of TaggedProfileFactory failed because a factory already exists for the given id.", // 23
598 "Registration of TaggedComponentFactory failed because a factory already exists for the given id.", // 24
599 "Iteration has no more elements.", // 25
600 "Invocation of this operation not allowed in post_init." // 26
603 static const char *TRANSIENT_TABLE
[] =
605 "Request discarded because of resource exhaustion in POA, or because POA is in discarding state.", // 1
606 "No usable profile in IOR.", // 2
607 "Request cancelled.", // 3
608 "POA destroyed." // 4
611 static const char *OBJ_ADAPTER_TABLE
[] =
613 "System exception in AdapterActivator::unknown_adapter.", // 1
614 "Incorrect servant type returned by servant manager", // 2
615 "No default servant available [POA policy].", // 3
616 "No servant manager available [POA policy].", // 4
617 "Violation of POA policy by ServantActivator::incarnate.",// 5
618 "Exception in PortableInterceptor::IORInterceptor.components_established.", // 6
619 "Null servant returned by servant manager." // 7
622 static const char *DATA_CONVERSION_TABLE
[] =
624 "Character does not map to negotiated transmission code set.", // 1
625 "Failure of PriorityMapping object." // 2
628 static const char *OBJECT_NOT_EXIST_TABLE
[] =
630 "Attempt to pass an unactivated (unregistered) value as an object reference.", // 1
631 "Failed to create or locate Object Adapter.", // 2
632 "Biomolecular Sequence Analysis Service is no longer available.", // 3
633 "Object Adapter inactive.", // 4
634 "This Poller has already delivered a reply to some client." // 5
637 static const char *INV_POLICY_TABLE
[] =
639 "Unable to reconcile IOR specified policy with the effective policy override.", // 1
640 "Invalid PolicyType.", // 2
641 "No PolicyFactory has been registered for the given PolicyType." // 3
644 static const char *ACTIVITY_COMPLETED_TABLE
[] =
646 "Activity context completed through timeout, or in some way other then requested." // 1
649 static const char *ACTIVITY_REQUIRED_TABLE
[] =
651 "Calling thread lacks required activity context." // 1
654 static const char *BAD_OPERATION_TABLE
[] =
656 "ServantManager returned wrong servant type.", // 1
657 "Operation or attribute not known to target object." // 2
660 static const char *BAD_CONTEXT_TABLE
[] =
662 "IDL context not found.", // 1
663 "No matching IDL context property." // 2
666 static const char *CODESET_INCOMPATIBLE_TABLE
[] =
668 "Codeset negotiation failed.", // 1
669 "Codeset delivered in CodeSetContext is not supported by server as transmission codeset." // 2
672 static const char *INTF_REPOS_TABLE
[] =
674 "Interface Repository not available.", // 1
675 "No entry for requested interface in Interface Repository." // 2
678 static const char *TIMEOUT_TABLE
[] =
680 "Reply is not available in the Poller by the timeout set for it.", // 1
681 "End time specified in RequestEndTimePolicy or RelativeRequestTimeoutPolicy has expired.", // 2
682 "End time specified in ReplyEndTimePolicy or RelativeReplyTimeoutPolicy has expired." // 3
686 return "*unknown description*";
688 --minor_code
; // Adjust to match table offset.
690 CORBA::UNKNOWN
const * unknown_exception
=
691 dynamic_cast <const CORBA::UNKNOWN
*> (&exc
);
692 if (unknown_exception
!= nullptr
693 && minor_code
< sizeof UNKNOWN_TABLE
/ sizeof (char *))
694 return UNKNOWN_TABLE
[minor_code
];
696 CORBA::BAD_PARAM
const * bad_param__exception
=
697 dynamic_cast <const CORBA::BAD_PARAM
*> (&exc
);
698 if (bad_param__exception
!= nullptr
699 && minor_code
< sizeof BAD_PARAM_TABLE
/ sizeof (char *))
700 return BAD_PARAM_TABLE
[minor_code
];
702 CORBA::IMP_LIMIT
const * imp_limit_exception
=
703 dynamic_cast <const CORBA::IMP_LIMIT
*> (&exc
);
704 if (imp_limit_exception
!= nullptr
705 && minor_code
< sizeof IMP_LIMIT_TABLE
/ sizeof (char *))
706 return IMP_LIMIT_TABLE
[minor_code
];
708 CORBA::INITIALIZE
const * initialize_exception
=
709 dynamic_cast <const CORBA::INITIALIZE
*> (&exc
);
710 if (initialize_exception
!= nullptr
711 && minor_code
< sizeof INITIALIZE_TABLE
/ sizeof (char *))
712 return INITIALIZE_TABLE
[minor_code
];
714 CORBA::INV_OBJREF
const * inv_objref_exception
=
715 dynamic_cast <const CORBA::INV_OBJREF
*> (&exc
);
716 if (inv_objref_exception
!= nullptr
717 && minor_code
< sizeof INV_OBJREF_TABLE
/ sizeof (char *))
718 return INV_OBJREF_TABLE
[minor_code
];
720 CORBA::MARSHAL
const * marshal_exception
=
721 dynamic_cast <const CORBA::MARSHAL
*> (&exc
);
722 if (marshal_exception
!= nullptr
723 && minor_code
< sizeof MARSHAL_TABLE
/ sizeof (char *))
724 return MARSHAL_TABLE
[minor_code
];
726 CORBA::BAD_TYPECODE
const * bad_typecode_exception
=
727 dynamic_cast <const CORBA::BAD_TYPECODE
*> (&exc
);
728 if (bad_typecode_exception
!= nullptr
729 && minor_code
< sizeof BAD_TYPECODE_TABLE
/ sizeof (char *))
730 return BAD_TYPECODE_TABLE
[minor_code
];
732 CORBA::NO_IMPLEMENT
const * no_implement_exception
=
733 dynamic_cast <const CORBA::NO_IMPLEMENT
*> (&exc
);
734 if (no_implement_exception
!= nullptr
735 && minor_code
< sizeof NO_IMPLEMENT_TABLE
/ sizeof (char *))
736 return NO_IMPLEMENT_TABLE
[minor_code
];
738 CORBA::NO_RESOURCES
const * no_resource_exception
=
739 dynamic_cast <const CORBA::NO_RESOURCES
*> (&exc
);
740 if (no_resource_exception
!= nullptr
741 && minor_code
< sizeof NO_RESOURCES_TABLE
/ sizeof (char *))
742 return NO_RESOURCES_TABLE
[minor_code
];
744 CORBA::BAD_INV_ORDER
const * bad_inv_order_exception
=
745 dynamic_cast <const CORBA::BAD_INV_ORDER
*> (&exc
);
746 if (bad_inv_order_exception
!= nullptr
747 && minor_code
< sizeof BAD_INV_ORDER_TABLE
/ sizeof (char *))
748 return BAD_INV_ORDER_TABLE
[minor_code
];
750 CORBA::TRANSIENT
const * transient_exception
=
751 dynamic_cast <const CORBA::TRANSIENT
*> (&exc
);
752 if (transient_exception
!= nullptr
753 && minor_code
< sizeof TRANSIENT_TABLE
/ sizeof (char *))
754 return TRANSIENT_TABLE
[minor_code
];
756 CORBA::OBJ_ADAPTER
const * obj_adapter_exception
=
757 dynamic_cast <const CORBA::OBJ_ADAPTER
*> (&exc
);
758 if (obj_adapter_exception
!= nullptr
759 && minor_code
< sizeof OBJ_ADAPTER_TABLE
/ sizeof (char *))
760 return OBJ_ADAPTER_TABLE
[minor_code
];
762 CORBA::DATA_CONVERSION
const * data_conversion_exception
=
763 dynamic_cast <const CORBA::DATA_CONVERSION
*> (&exc
);
764 if (data_conversion_exception
!= nullptr
765 && minor_code
< sizeof DATA_CONVERSION_TABLE
/ sizeof (char *))
766 return DATA_CONVERSION_TABLE
[minor_code
];
768 CORBA::OBJECT_NOT_EXIST
const * object_not_exist_exception
=
769 dynamic_cast <const CORBA::OBJECT_NOT_EXIST
*> (&exc
);
770 if (object_not_exist_exception
!= nullptr
771 && minor_code
< sizeof OBJECT_NOT_EXIST_TABLE
/ sizeof (char *))
772 return OBJECT_NOT_EXIST_TABLE
[minor_code
];
774 CORBA::INV_POLICY
const * inv_policy_exception
=
775 dynamic_cast <const CORBA::INV_POLICY
*> (&exc
);
776 if (inv_policy_exception
!= nullptr
777 && minor_code
< sizeof INV_POLICY_TABLE
/ sizeof (char *))
778 return INV_POLICY_TABLE
[minor_code
];
780 CORBA::ACTIVITY_COMPLETED
const * activity_completed_exception
=
781 dynamic_cast <const CORBA::ACTIVITY_COMPLETED
*> (&exc
);
782 if (activity_completed_exception
!= nullptr
783 && minor_code
< sizeof ACTIVITY_COMPLETED_TABLE
/ sizeof (char *))
784 return ACTIVITY_COMPLETED_TABLE
[minor_code
];
786 CORBA::ACTIVITY_REQUIRED
const * activity_required_exception
=
787 dynamic_cast <const CORBA::ACTIVITY_REQUIRED
*> (&exc
);
788 if (activity_required_exception
!= nullptr
789 && minor_code
< sizeof ACTIVITY_REQUIRED_TABLE
/ sizeof (char *))
790 return ACTIVITY_REQUIRED_TABLE
[minor_code
];
792 CORBA::BAD_OPERATION
const * bad_operation_exception
=
793 dynamic_cast <const CORBA::BAD_OPERATION
*> (&exc
);
794 if (bad_operation_exception
!= nullptr
795 && minor_code
< sizeof BAD_OPERATION_TABLE
/ sizeof (char *))
796 return BAD_OPERATION_TABLE
[minor_code
];
798 CORBA::BAD_CONTEXT
const * bad_context_exception
=
799 dynamic_cast <const CORBA::BAD_CONTEXT
*> (&exc
);
800 if (bad_context_exception
!= nullptr
801 && minor_code
< sizeof BAD_CONTEXT_TABLE
/ sizeof (char *))
802 return BAD_CONTEXT_TABLE
[minor_code
];
804 CORBA::CODESET_INCOMPATIBLE
const * codeset_incompatible_exception
=
805 dynamic_cast <const CORBA::CODESET_INCOMPATIBLE
*> (&exc
);
806 if (codeset_incompatible_exception
!= nullptr
807 && minor_code
< sizeof CODESET_INCOMPATIBLE_TABLE
/ sizeof (char *))
808 return CODESET_INCOMPATIBLE_TABLE
[minor_code
];
810 CORBA::INTF_REPOS
const * intf_repos_exception
=
811 dynamic_cast <const CORBA::INTF_REPOS
*> (&exc
);
812 if (intf_repos_exception
!= nullptr
813 && minor_code
< sizeof INTF_REPOS_TABLE
/ sizeof (char *))
814 return INTF_REPOS_TABLE
[minor_code
];
816 CORBA::TIMEOUT
const * timeout_exception
=
817 dynamic_cast <const CORBA::TIMEOUT
*> (&exc
);
818 if (timeout_exception
!= nullptr
819 && minor_code
< sizeof TIMEOUT_TABLE
/ sizeof (char *))
820 return TIMEOUT_TABLE
[minor_code
];
823 ACE_UNUSED_ARG (exc
);
824 ACE_UNUSED_ARG (minor_code
);
825 #endif /* !ACE_NDEBUG */
827 return "*unknown description*";
830 TAO_END_VERSIONED_NAMESPACE_DECL
832 #if defined (THREAD_CANCELLED)
833 #undef THREAD_CANCELLED
834 #endif /* THREAD_CANCELLED */
836 // List of standard/system exceptions ... used to create static
837 // storage for their typecodes, then later to initialize that storage
838 // using the routine above. (It's just too painful to init these
839 // typecodes statically in all cases!)
841 #define STANDARD_EXCEPTION_LIST \
842 TAO_SYSTEM_EXCEPTION (UNKNOWN) \
843 TAO_SYSTEM_EXCEPTION (BAD_PARAM) \
844 TAO_SYSTEM_EXCEPTION (NO_MEMORY) \
845 TAO_SYSTEM_EXCEPTION (IMP_LIMIT) \
846 TAO_SYSTEM_EXCEPTION (COMM_FAILURE) \
847 TAO_SYSTEM_EXCEPTION (INV_OBJREF) \
848 TAO_SYSTEM_EXCEPTION (OBJECT_NOT_EXIST) \
849 TAO_SYSTEM_EXCEPTION (NO_PERMISSION) \
850 TAO_SYSTEM_EXCEPTION (INTERNAL) \
851 TAO_SYSTEM_EXCEPTION (MARSHAL) \
852 TAO_SYSTEM_EXCEPTION (INITIALIZE) \
853 TAO_SYSTEM_EXCEPTION (NO_IMPLEMENT) \
854 TAO_SYSTEM_EXCEPTION (BAD_TYPECODE) \
855 TAO_SYSTEM_EXCEPTION (BAD_OPERATION) \
856 TAO_SYSTEM_EXCEPTION (NO_RESOURCES) \
857 TAO_SYSTEM_EXCEPTION (NO_RESPONSE) \
858 TAO_SYSTEM_EXCEPTION (PERSIST_STORE) \
859 TAO_SYSTEM_EXCEPTION (BAD_INV_ORDER) \
860 TAO_SYSTEM_EXCEPTION (TRANSIENT) \
861 TAO_SYSTEM_EXCEPTION (FREE_MEM) \
862 TAO_SYSTEM_EXCEPTION (INV_IDENT) \
863 TAO_SYSTEM_EXCEPTION (INV_FLAG) \
864 TAO_SYSTEM_EXCEPTION (INTF_REPOS) \
865 TAO_SYSTEM_EXCEPTION (BAD_CONTEXT) \
866 TAO_SYSTEM_EXCEPTION (OBJ_ADAPTER) \
867 TAO_SYSTEM_EXCEPTION (DATA_CONVERSION) \
868 TAO_SYSTEM_EXCEPTION (INV_POLICY) \
869 TAO_SYSTEM_EXCEPTION (REBIND) \
870 TAO_SYSTEM_EXCEPTION (TIMEOUT) \
871 TAO_SYSTEM_EXCEPTION (TRANSACTION_UNAVAILABLE) \
872 TAO_SYSTEM_EXCEPTION (TRANSACTION_MODE) \
873 TAO_SYSTEM_EXCEPTION (TRANSACTION_REQUIRED) \
874 TAO_SYSTEM_EXCEPTION (TRANSACTION_ROLLEDBACK) \
875 TAO_SYSTEM_EXCEPTION (INVALID_TRANSACTION) \
876 TAO_SYSTEM_EXCEPTION (CODESET_INCOMPATIBLE) \
877 TAO_SYSTEM_EXCEPTION (BAD_QOS) \
878 TAO_SYSTEM_EXCEPTION (INVALID_ACTIVITY) \
879 TAO_SYSTEM_EXCEPTION (ACTIVITY_COMPLETED) \
880 TAO_SYSTEM_EXCEPTION (ACTIVITY_REQUIRED) \
881 TAO_SYSTEM_EXCEPTION (THREAD_CANCELLED)
883 static const char *repo_id_array
[] = {
884 #define TAO_SYSTEM_EXCEPTION(name) \
885 (char *) "IDL:omg.org/CORBA/" #name ":1.0",
886 STANDARD_EXCEPTION_LIST
887 #undef TAO_SYSTEM_EXCEPTION
891 // Since we add an extra element subtract 1
892 static const CORBA::ULong array_sz
=
893 (sizeof (repo_id_array
) / sizeof (char const *)) - 1;
895 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
897 TAO::excp_factory excp_array
[] = {
898 #define TAO_SYSTEM_EXCEPTION(name) \
899 &CORBA::name::_tao_create,
900 STANDARD_EXCEPTION_LIST
901 #undef TAO_SYSTEM_EXCEPTION
905 // Concrete SystemException constructors
906 #define TAO_SYSTEM_EXCEPTION(name) \
907 CORBA::name ::name () \
908 : CORBA::SystemException ("IDL:omg.org/CORBA/" #name ":1.0", \
911 CORBA::COMPLETED_NO) \
915 CORBA::name ::name (CORBA::ULong code, CORBA::CompletionStatus completed) \
916 : CORBA::SystemException ("IDL:omg.org/CORBA/" #name ":1.0", \
923 STANDARD_EXCEPTION_LIST
924 #undef TAO_SYSTEM_EXCEPTION
926 #define TAO_SYSTEM_EXCEPTION(name) \
927 CORBA::TypeCode_ptr \
928 CORBA::name ::_tao_type () const \
930 TAO_AnyTypeCode_Adapter *adapter = \
931 ACE_Dynamic_Service<TAO_AnyTypeCode_Adapter>::instance ( \
932 "AnyTypeCode_Adapter"); \
933 if (adapter != nullptr) \
934 return adapter->_tao_type_ ## name (); \
937 TAOLIB_ERROR ((LM_ERROR, \
938 ACE_TEXT ("(%P|%t) %p\n"), \
939 ACE_TEXT ("Unable to find the ") \
940 ACE_TEXT ("AnyTypeCode Adapter instance"))); \
945 STANDARD_EXCEPTION_LIST
946 #undef TAO_SYSTEM_EXCEPTION
948 CORBA::SystemException
*
949 TAO::create_system_exception (const char *id
)
951 for (CORBA::ULong i
= 0; i
< array_sz
; ++i
)
953 if (ACE_OS::strcmp (id
, repo_id_array
[i
]) == 0)
954 return (*(excp_array
[i
])) ();
960 #define TAO_SYSTEM_EXCEPTION(name) \
962 CORBA::name ::_raise () const \
967 STANDARD_EXCEPTION_LIST
968 #undef TAO_SYSTEM_EXCEPTION
970 #define TAO_SYSTEM_EXCEPTION(name) \
972 CORBA::name ::_tao_duplicate () const \
974 CORBA::Exception * result = 0; \
975 ACE_NEW_RETURN (result, CORBA::name (*this), 0); \
979 STANDARD_EXCEPTION_LIST
980 #undef TAO_SYSTEM_EXCEPTION
982 #define TAO_SYSTEM_EXCEPTION(name) \
983 CORBA::SystemException * \
984 CORBA::name ::_tao_create () \
986 CORBA::name *result = 0; \
987 ACE_NEW_RETURN (result, CORBA::name (), 0); \
991 STANDARD_EXCEPTION_LIST
992 #undef TAO_SYSTEM_EXCEPTION
994 TAO_END_VERSIONED_NAMESPACE_DECL