SystemException.cpp

Go to the documentation of this file.
00001 #include "tao/SystemException.h"
00002 #include "tao/ORB_Constants.h"
00003 #include "tao/CORBA_String.h"
00004 #include "tao/debug.h"
00005 #include "tao/Allocation_Macros.h"
00006 
00007 #include "ace/Malloc.h"
00008 #include "ace/SString.h"
00009 #include "ace/OS_NS_string.h"
00010 #include "ace/OS_NS_stdio.h"
00011 
00012 #if !defined (__ACE_INLINE__)
00013 # include "tao/SystemException.inl"
00014 #endif /* __ACE_INLINE__ */
00015 
00016 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00017 
00018 /**
00019  * @name @c errno Encoding
00020  *
00021  * The @c errno encoding is located in the bottom 7 bits.
00022  */
00023 //@{
00024 const CORBA::ULong TAO_UNSPECIFIED_MINOR_CODE        = 0x0U;
00025 const CORBA::ULong TAO_ETIMEDOUT_MINOR_CODE          = 0x1U;
00026 const CORBA::ULong TAO_ENFILE_MINOR_CODE             = 0x2U;
00027 const CORBA::ULong TAO_EMFILE_MINOR_CODE             = 0x3U;
00028 const CORBA::ULong TAO_EPIPE_MINOR_CODE              = 0x4U;
00029 const CORBA::ULong TAO_ECONNREFUSED_MINOR_CODE       = 0x5U;
00030 const CORBA::ULong TAO_ENOENT_MINOR_CODE             = 0x6U;
00031 const CORBA::ULong TAO_EBADF_MINOR_CODE              = 0x7U;
00032 const CORBA::ULong TAO_ENOSYS_MINOR_CODE             = 0x8U;
00033 const CORBA::ULong TAO_EPERM_MINOR_CODE              = 0x9U;
00034 const CORBA::ULong TAO_EAFNOSUPPORT_MINOR_CODE       = 0xAU;
00035 const CORBA::ULong TAO_EAGAIN_MINOR_CODE             = 0xBU;
00036 const CORBA::ULong TAO_ENOMEM_MINOR_CODE             = 0xCU;
00037 const CORBA::ULong TAO_EACCES_MINOR_CODE             = 0xDU;
00038 const CORBA::ULong TAO_EFAULT_MINOR_CODE             = 0xEU;
00039 const CORBA::ULong TAO_EBUSY_MINOR_CODE              = 0xFU;
00040 const CORBA::ULong TAO_EEXIST_MINOR_CODE             = 0x10U;
00041 const CORBA::ULong TAO_EINVAL_MINOR_CODE             = 0x11U;
00042 const CORBA::ULong TAO_ECOMM_MINOR_CODE              = 0x12U;
00043 const CORBA::ULong TAO_ECONNRESET_MINOR_CODE         = 0x13U;
00044 const CORBA::ULong TAO_ENOTSUP_MINOR_CODE            = 0x14U;
00045 // *Don't* use TAO_<errno>_MINOR_CODE greater than 0x7FU!
00046 //@}
00047 
00048 // ****************************************************************
00049 
00050 CORBA::SystemException::SystemException (void)
00051   : minor_ (0),
00052     completed_ (CORBA::COMPLETED_NO)
00053 {
00054 }
00055 
00056 CORBA::SystemException::SystemException (const char *repository_id,
00057                                          const char *local_name,
00058                                          CORBA::ULong code,
00059                                          CORBA::CompletionStatus completed)
00060   : CORBA::Exception (repository_id,
00061                       local_name),
00062     minor_ (code),
00063     completed_ (completed)
00064 {
00065 }
00066 
00067 CORBA::SystemException::SystemException (CORBA::ULong code,
00068                                          CORBA::CompletionStatus completed)
00069   : minor_ (code),
00070     completed_ (completed)
00071 {
00072 }
00073 
00074 CORBA::SystemException::SystemException (const CORBA::SystemException &src)
00075   : CORBA::Exception (src),
00076     minor_ (src.minor_),
00077     completed_ (src.completed_)
00078 {
00079 }
00080 
00081 CORBA::SystemException::~SystemException (void)
00082 {
00083 }
00084 
00085 CORBA::SystemException &
00086 CORBA::SystemException::operator= (const CORBA::SystemException &src)
00087 {
00088   this->Exception::operator= (src);
00089 
00090   this->minor_ = src.minor_;
00091   this->completed_ = src.completed_;
00092 
00093   return *this;
00094 }
00095 
00096 void
00097 CORBA::SystemException::_tao_encode(TAO_OutputCDR&) const
00098 {
00099   throw ::CORBA::MARSHAL ();
00100 }
00101 
00102 void
00103 CORBA::SystemException::_tao_decode(TAO_InputCDR&)
00104 {
00105   throw ::CORBA::MARSHAL ();
00106 }
00107 
00108 CORBA::ULong
00109 CORBA::SystemException::_tao_errno (int errno_value)
00110 {
00111   switch (errno_value)
00112     {
00113     case 0:
00114       return TAO_UNSPECIFIED_MINOR_CODE;
00115     case ETIMEDOUT:
00116       return TAO_ETIMEDOUT_MINOR_CODE;
00117     case ENFILE:
00118       return TAO_ENFILE_MINOR_CODE;
00119     case EPIPE:
00120       return TAO_EPIPE_MINOR_CODE;
00121     case ECONNREFUSED:
00122       return TAO_ECONNREFUSED_MINOR_CODE;
00123     case ENOENT:
00124       return TAO_ENOENT_MINOR_CODE;
00125 
00126 #if !defined (ACE_HAS_WINCE)
00127     case EMFILE:
00128       return TAO_EMFILE_MINOR_CODE;
00129     case EBADF:
00130       return TAO_EBADF_MINOR_CODE;
00131     case EPERM:
00132       return TAO_EPERM_MINOR_CODE;
00133     case EINVAL:
00134       return TAO_EINVAL_MINOR_CODE;
00135 #endif  // ACE_HAS_WINCE
00136 
00137 #if (ENOSYS != EFAULT)
00138     case ENOSYS:
00139       return TAO_ENOSYS_MINOR_CODE;
00140 #endif /* ENOSYS != EFAULT */
00141     case EAFNOSUPPORT:
00142       return TAO_EAFNOSUPPORT_MINOR_CODE;
00143     case EAGAIN:
00144       return TAO_EAGAIN_MINOR_CODE;
00145     case ENOMEM:
00146       return TAO_ENOMEM_MINOR_CODE;
00147     case EACCES:
00148       return TAO_EACCES_MINOR_CODE;
00149     case EFAULT:
00150       return TAO_EFAULT_MINOR_CODE;
00151     case EBUSY:
00152       return TAO_EBUSY_MINOR_CODE;
00153     case EEXIST:
00154       return TAO_EEXIST_MINOR_CODE;
00155     case ECOMM:
00156       return TAO_ECOMM_MINOR_CODE;
00157     case ECONNRESET:
00158       return TAO_ECONNRESET_MINOR_CODE;
00159 #if (ENOTSUP != ENOSYS)
00160     case ENOTSUP:
00161       return TAO_ENOTSUP_MINOR_CODE;
00162 #endif /* ENOSYS != EFAULT */
00163     default:
00164       // Mask off bottom 7 bits and return them.
00165       return errno_value & 0x7FU;
00166     }
00167 }
00168 
00169 CORBA::Exception *
00170 CORBA::SystemException::_tao_duplicate (void) const
00171 {
00172   return 0;
00173 }
00174 
00175 CORBA::ULong
00176 CORBA::SystemException::_tao_minor_code (u_int location, int errno_value)
00177 {
00178   return
00179     TAO::VMCID
00180     | location
00181     | _tao_errno (errno_value);
00182 }
00183 
00184 void
00185 CORBA::SystemException::_tao_print_system_exception (FILE *) const
00186 {
00187   ACE_ERROR ((LM_ERROR,
00188               ACE_TEXT("(%P|%t) system exception, ID '%C'\n"),
00189               this->_info ().c_str ()));
00190 }
00191 
00192 ACE_CString
00193 CORBA::SystemException::_info (void) const
00194 {
00195   // @@ there are a few other "user exceptions" in the CORBA scope,
00196   // they're not all standard/system exceptions ... really need to
00197   // either compare exhaustively against all those IDs (yeech) or
00198   // (preferably) to represent the exception type directly in the
00199   // exception value so it can be queried.
00200 
00201   ACE_CString info = "system exception, ID '";
00202   info += this->_rep_id ();
00203   info += "'\n";
00204 
00205   CORBA::ULong const VMCID = this->minor () & 0xFFFFF000u;
00206 
00207   if (VMCID == TAO::VMCID)
00208     {
00209       // @@ Move the following code to a subroutine, it is too long already!
00210       const char *location = 0;
00211       switch (this->minor () & 0x00000F80u)
00212         {
00213         case TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE:
00214           location = "location forward failed";
00215           break;
00216         case TAO_INVOCATION_SEND_REQUEST_MINOR_CODE:
00217           location = "send request failed";
00218           break;
00219         case TAO_POA_DISCARDING:
00220           location = "poa in discarding state";
00221           break;
00222         case TAO_POA_HOLDING:
00223           location = "poa in holding state";
00224           break;
00225         case TAO_POA_INACTIVE:
00226           location = "poa in inactive state";
00227           break;
00228         case TAO_UNHANDLED_SERVER_CXX_EXCEPTION:
00229           location = "unhandled c++ exception in server side";
00230           break;
00231         case TAO_INVOCATION_RECV_REQUEST_MINOR_CODE:
00232           location = "failed to recv request response";
00233           break;
00234         case TAO_CONNECTOR_REGISTRY_NO_USABLE_PROTOCOL:
00235           location = "all protocols failed to parse the IOR";
00236           break;
00237         case TAO_MPROFILE_CREATION_ERROR:
00238           location = "error during MProfile creation";
00239           break;
00240         case TAO_TIMEOUT_CONNECT_MINOR_CODE:
00241           location = "timeout during connect";
00242           break;
00243         case TAO_TIMEOUT_SEND_MINOR_CODE:
00244           location = "timeout during send";
00245           break;
00246         case TAO_TIMEOUT_RECV_MINOR_CODE:
00247           location = "timeout during recv";
00248           break;
00249         case TAO_IMPLREPO_MINOR_CODE:
00250           location = "implrepo server exception";
00251           break;
00252         case TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE:
00253           location = "endpoint initialization failure in Acceptor Registry";
00254           break;
00255         case TAO_ORB_CORE_INIT_LOCATION_CODE:
00256           location = "ORB Core initialization failed";
00257           break;
00258         case TAO_POLICY_NARROW_CODE:
00259           location = "Failure when narrowing a Policy";
00260           break;
00261         case TAO_GUARD_FAILURE:
00262           location = "Failure when trying to acquire a guard/monitor";
00263           break;
00264         case TAO_POA_BEING_DESTROYED:
00265           location = "POA has been destroyed or is currently being destroyed";
00266           break;
00267         case TAO_AMH_REPLY_LOCATION_CODE:
00268           location = "Failure when trying to send AMH reply";
00269           break;
00270         case TAO_RTCORBA_THREAD_CREATION_LOCATION_CODE:
00271           location = "Failure in thread creation for RTCORBA thread pool";
00272           break;
00273         default:
00274           location = "unknown location";
00275         }
00276 
00277       const char *errno_indication;
00278       char unknown_errno [255];
00279       CORBA::ULong minor_code = this->minor () & 0x7FU;
00280       switch (minor_code)
00281         {
00282         case TAO_UNSPECIFIED_MINOR_CODE:
00283           errno_indication = "unspecified errno";
00284           break;
00285         case TAO_ETIMEDOUT_MINOR_CODE:
00286           errno_indication = "ETIMEOUT";
00287           break;
00288         case TAO_ENFILE_MINOR_CODE:
00289           errno_indication = "ENFILE";
00290           break;
00291         case TAO_EMFILE_MINOR_CODE:
00292           errno_indication = "EMFILE";
00293           break;
00294         case TAO_EPIPE_MINOR_CODE:
00295           errno_indication = "EPIPE";
00296           break;
00297         case TAO_ECONNREFUSED_MINOR_CODE:
00298           errno_indication = "ECONNREFUSED";
00299           break;
00300         case TAO_ENOENT_MINOR_CODE:
00301           errno_indication = "ENOENT";
00302           break;
00303         case TAO_EBADF_MINOR_CODE:
00304           errno_indication = "EBADF";
00305           break;
00306         case TAO_ENOSYS_MINOR_CODE:
00307           errno_indication = "ENOSYS";
00308           break;
00309         case TAO_EPERM_MINOR_CODE:
00310           errno_indication = "EPERM";
00311           break;
00312         case TAO_EAFNOSUPPORT_MINOR_CODE:
00313           errno_indication = "EAFNOSUPPORT";
00314           break;
00315         case TAO_EAGAIN_MINOR_CODE:
00316           errno_indication = "EAGAIN";
00317           break;
00318         case TAO_ENOMEM_MINOR_CODE:
00319           errno_indication = "ENOMEM";
00320           break;
00321         case TAO_EACCES_MINOR_CODE:
00322           errno_indication = "EACCES";
00323           break;
00324         case TAO_EFAULT_MINOR_CODE:
00325           errno_indication = "EFAULT";
00326           break;
00327         case TAO_EBUSY_MINOR_CODE:
00328           errno_indication = "EBUSY";
00329           break;
00330         case TAO_EEXIST_MINOR_CODE:
00331           errno_indication = "EEXIST";
00332           break;
00333         case TAO_EINVAL_MINOR_CODE:
00334           errno_indication = "EINVAL";
00335           break;
00336         case TAO_ECOMM_MINOR_CODE:
00337           errno_indication = "ECOMM";
00338           break;
00339         case TAO_ECONNRESET_MINOR_CODE:
00340           errno_indication = "ECONNRESET";
00341           break;
00342         case TAO_ENOTSUP_MINOR_CODE:
00343           errno_indication = "ENOTSUP";
00344           break;
00345         default:
00346           {
00347             // 7 bits of some other errno.
00348             ACE_OS::snprintf (unknown_errno,
00349                              255,
00350                              "low 7 bits of errno: %3u %s",
00351                              minor_code, ACE_OS::strerror (minor_code));
00352 
00353             errno_indication = unknown_errno;
00354           }
00355         }
00356 
00357       char buffer[BUFSIZ];
00358       ACE_OS::snprintf (buffer,
00359                        BUFSIZ,
00360                        "TAO exception, "
00361                        "minor code = %x (%s; %s), "
00362                        "completed = %s\n",
00363                        minor_code,
00364                        location,
00365                        errno_indication,
00366                        (completed () == CORBA::COMPLETED_YES) ? "YES" :
00367                        (completed () == CORBA::COMPLETED_NO) ? "NO" :
00368                        (completed () == CORBA::COMPLETED_MAYBE) ? "MAYBE" :
00369                        "garbage");
00370 
00371       info += buffer;
00372     }
00373   else if (VMCID == CORBA::OMGVMCID)
00374     {
00375       CORBA::ULong const minor_code = this->minor () & 0xFFFU;
00376 
00377       const char *minor_description = 0;
00378 
00379       if (minor_code > 0)
00380           minor_description =
00381             CORBA::SystemException::_tao_get_omg_exception_description (
00382               *this,
00383               minor_code);
00384       else
00385         minor_description = "*unknown description*";
00386 
00387       char buffer[BUFSIZ];
00388       ACE_OS::snprintf (buffer,
00389                        BUFSIZ,
00390                        "OMG minor code (%d), "
00391                        "described as '%s', "
00392                        "completed = %s\n",
00393                        minor_code,
00394                        minor_description,
00395                        (completed () == CORBA::COMPLETED_YES) ? "YES" :
00396                        (completed () == CORBA::COMPLETED_NO) ? "NO" :
00397                        (completed () == CORBA::COMPLETED_MAYBE) ? "MAYBE" :
00398                        "garbage");
00399 
00400       info += buffer;
00401     }
00402   else
00403     {
00404       char buffer[BUFSIZ];
00405       ACE_OS::snprintf (buffer,
00406                        BUFSIZ,
00407                        "Unknown vendor minor code id (%x), "
00408                        "minor code = %x, completed = %s\n",
00409                        VMCID,
00410                        this->minor (),  // Use the raw minor code
00411                        (completed () == CORBA::COMPLETED_YES) ? "YES" :
00412                        (completed () == CORBA::COMPLETED_NO) ? "NO" :
00413                        (completed () == CORBA::COMPLETED_MAYBE) ? "MAYBE" :
00414                        "garbage");
00415 
00416       info += buffer;
00417     }
00418 
00419   return info;
00420 }
00421 
00422 const char *
00423 CORBA::SystemException::_tao_get_omg_exception_description (
00424   const CORBA::SystemException &exc,
00425   CORBA::ULong minor_code)
00426 {
00427 #ifndef ACE_NDEBUG
00428 
00429   static const char *UNKNOWN_TABLE[] =
00430     {
00431       "Unlisted user exception received by client.",    // 1
00432       "Non-standard SystemException not supported.",    // 2
00433       "An unknown user exception received by a portable interceptor." // 3
00434     };
00435 
00436   static const char *BAD_PARAM_TABLE[] =
00437     {
00438       "Failure to register, unregister, or lookup value factory.", // 1
00439       "RID already defined in IFR.",                               // 2
00440       "Name already used in the context in IFR.",                  // 3
00441       "Target is not a valid container.",                          // 4
00442       "Name clash in inherited context.",                          // 5
00443       "Incorrect type for abstract interface.",                    // 6
00444       "string_to_object conversion failed due to a bad scheme name.", // 7
00445       "string_to_object conversion failed due to a bad address.",  // 8
00446       "string_to_object conversion failed due to a bad schema specific part.",// 9
00447       "string_to_object conversion failed due to non specific reason.", // 10
00448       "Attempt to derive abstract interface from non-abstract base interface in the Interface Repository.", // 11
00449       "Attempt to let a ValueDef support more than one non-abstract interface in the Interface Repository.", // 12
00450       "Attempt to use an incomplete TypeCode as a parameter.",     // 13
00451       "Invalid object id passed to POA::create_reference_by_id.",  // 14
00452       "Bad name argument in TypeCode operation.",                  // 15
00453       "Bad RepositoryId argument in TypeCode operation.",          // 16
00454       "Invalid member name in TypeCode operation.",                 // 17
00455       "Duplicate label value in create_union_tc.",                 // 18
00456       "Incompatible TypeCode of label and discriminator in create_union_tc.", // 19
00457       "Supplied discriminator type illegitimate in create_union_tc.", // 20
00458       "Any passed to ServerRequest::set_exception does not contain an exception.", // 21
00459       "Unlisted user exception passed to ServerRequest::set_exception", // 22
00460       "wchar transmission code set not in service context.",       // 23
00461       "Service context is not in OMG-defined range.",              // 24
00462       "Enum value out of range.",                                  // 25
00463       "Invalid service context Id in portable interceptor.",       // 26
00464       "Attempt to call register_initial_reference with a null Object.", // 27
00465       "Invalid component Id in portable interceptor.",             // 28
00466       "Invalid profile Id in portable interceptor.",               // 29
00467       "Two or more Policy objects with the same PolicyType value supplied to Object::set_policy_overrides or PolicyManager::set_policy_overrides." // 30
00468       "Attempt to define a oneway operation with non-void result, out or inout parameters or user exceptions.", // 31
00469       "DII asked to create request for an implicit operation.",     // 32,
00470       "An OTS/XA integration xa_ call returned XAER_INVAL.",        // 33
00471       "Union branch modifier called with bad case label discriminator.", // 34
00472       "Illegal IDL context property name.",   // 35
00473       "Illegal IDL property search string.",  // 36
00474       "Illegal IDL context name.",            // 37
00475       "Non-empty IDL context.",               // 38
00476       "Unsupported RMI/IDL customer value type stream format.",  // 39
00477       "ORB output stream does not support ValueOutputStream interface.", // 40
00478       "ORB input stream does not support ValueInputStream interface.",    // 41
00479       "Character support limited to ISO 8859-1 for this object reference", // 42
00480       "Attempt to add a Pollable to a second PollableSet." // 43
00481     };
00482 
00483   static const char *IMP_LIMIT_TABLE[] =
00484     {
00485       "Unable to use any profile in IOR." // 1
00486     };
00487 
00488   static const char *INITIALIZE_TABLE[] =
00489     {
00490       "Priority range too restricted for ORB." // 1
00491     };
00492 
00493 
00494   static const char *INV_OBJREF_TABLE[] =
00495     {
00496       "wchar Code Set support not specified.", // 1
00497       "Codeset component required for type using wchar or wstring data." // 2
00498     };
00499 
00500   static const char *MARSHAL_TABLE[] =
00501     {
00502       "Unable to locate value factory.",  // 1
00503       "ServerRequest::set_result called before ServerRequest::ctx when the operation IDL contains a context clause.", // 2
00504       "NVList passed to ServerRequest::arguments does not describe all parameters passed by client.", // 3
00505       "Attempt to marshal Local object.", // 4
00506       "wchar or wstring data erroneously sent by client over GIOP 1.0 connection.", // 5
00507       "wchar or wstring data erroneously returned by server over GIOP 1.0 connection.", //6
00508       "Unsupported RMI/IDL custom value type stream format.", // 7
00509       "Custom data not compatible with ValueHandler read operation.", // 8
00510       "Codeset service contexts with different values recieved on the same connection." // 9
00511 
00512     };
00513 
00514   static const char *BAD_TYPECODE_TABLE[] =
00515     {
00516       "Attempt to marshal incomplete TypeCode.",              // 1
00517       "Member type code illegitimate in TypeCode operation.", // 2
00518       "Illegal parameter type."                               // 3
00519     };
00520 
00521   static const char *NO_IMPLEMENT_TABLE[] =
00522     {
00523       "Missing local value implementation.",        // 1
00524       "Incompatible value implementation version.", // 2
00525       "Unable to use any profile in IOR.",          // 3
00526       "Attempt to use DII on Local object.",        // 4
00527       "Biomolecular Sequence Analysis iterator cannot be reset.",         // 5
00528       "Biomolecular Sequence Analysis metadata is not available as XML.", // 6
00529       "Genomic Maps iterator cannot be rest.",       // 7
00530       "Operation not implemented in local object"   // 8
00531     };
00532 
00533   static const char *NO_RESOURCES_TABLE[] =
00534     {
00535       "Portable Interceptor operation not support in this binding.", // 1
00536       "No connection for request's priority."                        // 2
00537     };
00538 
00539   static const char *BAD_INV_ORDER_TABLE[] =
00540     {
00541       "Dependency exists in IFR preventing destruction of this object", // 1
00542       "Attempt to destroy indestructible objects in IFR.", // 2
00543       "Operation would deadlock.",                         // 3
00544       "ORB has shutdown.",                                 // 4
00545       "Attempt to invoke \"send\" or \"invoke\" operation of the same \"Request\" object more than once.", // 5
00546       "Attempt to set a servant manager after one has already been set.", // 6
00547       "ServerRequest::arguments called more than once or after a call to ServerRequest::set_exception.", // 7
00548       "ServerRequest::ctx called more than once or before ServerRequest::arguments or after ServerRequest::ctx, ServerRequest::set_result or ServerRequest::set_exception.", // 8
00549       "ServerRequest::set_result called more than once or before ServerRequest::arguments or after ServerRequest::set_result or ServerRequest::set_exception.", // 9
00550       "Attempt to send a DII request after it was sent previously.", // 10
00551       "Attempt to poll a DII request or to retrieve its result before the request was sent.", // 11
00552       "Attempt to poll a DII request or to retrieve its result after the result was retrieved previously.", // 12
00553       "Attempt to poll a synchronous DII request or to retrieve results from a synchronous DII request.", // 13
00554       "Invalid portable interceptor call",                 // 14
00555       "Service context add failed in portable interceptor because a service context with the given id already exists.", // 15
00556       "Registration of PolicyFactory failed because a factory already exists for the given type.", // 16
00557       "POA cannot create POAs while undergoing destruction.", // 17
00558       "Attempt to reassign priority.", // 18
00559       "An OTS/XA integration xa_start call returned XAER_OUTSIDE.", // 19
00560       "An OTS/XA integration xa_call returned XAER_PROTO.", // 20
00561       "Transaction context of request & client threads do not match in interceptor.", // 21
00562       "Poller has not returned any response yet.", // 22
00563       "Registration of TaggedProfileFactory failed because a factory already exists for the given id.", // 23
00564       "Registration of TaggedComponentFactory failed because a factory already exists for the given id.", // 24
00565        "Iteration has no more elements.", // 25
00566        "Invocation of this operation not allowed in post_init." // 26
00567 
00568     };
00569 
00570   static const char *TRANSIENT_TABLE[] =
00571     {
00572       "Request discarded because of resource exhaustion in POA, or because POA is in discarding state.", // 1
00573       "No usable profile in IOR.",                            // 2
00574       "Request cancelled.",                                   // 3
00575       "POA destroyed."                                        // 4
00576     };
00577 
00578   static const char *OBJ_ADAPTER_TABLE[] =
00579     {
00580       "System exception in AdapterActivator::unknown_adapter.",              // 1
00581       "Incorrect servant type returned by servant manager",     // 2
00582       "No default servant available [POA policy].",             // 3
00583       "No servant manager available [POA policy].",             // 4
00584       "Violation of POA policy by ServantActivator::incarnate.",// 5
00585       "Exception in PortableInterceptor::IORInterceptor.components_established.", // 6
00586       "Null servant returned by servant manager."               // 7
00587     };
00588 
00589   static const char *DATA_CONVERSION_TABLE[] =
00590     {
00591       "Character does not map to negotiated transmission code set.", // 1
00592       "Failure of PriorityMapping object."                           // 2
00593     };
00594 
00595   static const char *OBJECT_NOT_EXIST_TABLE[] =
00596     {
00597       "Attempt to pass an unactivated (unregistered) value as an object reference.", // 1
00598       "Failed to create or locate Object Adapter.", // 2
00599       "Biomolecular Sequence Analysis Service is no longer available.", // 3
00600       "Object Adapter inactive.", // 4
00601       "This Poller has already delivered a reply to some client." // 5
00602     };
00603 
00604   static const char *INV_POLICY_TABLE[] =
00605     {
00606       "Unable to reconcile IOR specified policy with the effective policy override.", // 1
00607       "Invalid PolicyType.", // 2
00608       "No PolicyFactory has been registered for the given PolicyType." // 3
00609     };
00610 
00611   static const char *ACTIVITY_COMPLETED_TABLE[] =
00612     {
00613       "Activity context completed through timeout, or in some way other then requested." // 1
00614     };
00615 
00616   static const char *ACTIVITY_REQUIRED_TABLE[] =
00617     {
00618       "Calling thread lacks required activity context." // 1
00619     };
00620 
00621   static const char *BAD_OPERATION_TABLE[] =
00622     {
00623       "ServantManager returned wrong servant type.", // 1
00624       "Operation or attribute not known to target object." // 2
00625     };
00626 
00627   static const char *BAD_CONTEXT_TABLE[] =
00628     {
00629       "IDL context not found.", // 1
00630       "No matching IDL context property." // 2
00631     };
00632 
00633   static const char *CODESET_INCOMPATIBLE_TABLE[] =
00634     {
00635       "Codeset negotiation failed.", // 1
00636       "Codeset delivered in CodeSetContext is not supported by server as transmission codeset." // 2
00637     };
00638 
00639   static const char *INTF_REPOS_TABLE[] =
00640     {
00641       "Interface Repository not available.", // 1
00642       "No entry for requested interface in Interface Repository." // 2
00643     };
00644 
00645   if (minor_code == 0)
00646     return "*unknown description*";
00647 
00648   --minor_code;  // Adjust to match table offset.
00649 
00650   CORBA::UNKNOWN const * unknown_exception =
00651     dynamic_cast <const CORBA::UNKNOWN *> (&exc);
00652   if (unknown_exception != 0
00653       && minor_code < sizeof UNKNOWN_TABLE / sizeof (char *))
00654     return UNKNOWN_TABLE[minor_code];
00655 
00656   CORBA::BAD_PARAM const * bad_param__exception =
00657     dynamic_cast <const CORBA::BAD_PARAM *> (&exc);
00658   if (bad_param__exception != 0
00659       && minor_code < sizeof BAD_PARAM_TABLE / sizeof (char *))
00660     return BAD_PARAM_TABLE[minor_code];
00661 
00662   CORBA::IMP_LIMIT const * imp_limit_exception =
00663     dynamic_cast <const CORBA::IMP_LIMIT *> (&exc);
00664   if (imp_limit_exception != 0
00665       && minor_code < sizeof IMP_LIMIT_TABLE / sizeof (char *))
00666     return IMP_LIMIT_TABLE[minor_code];
00667 
00668   CORBA::INITIALIZE const * initialize_exception =
00669     dynamic_cast <const CORBA::INITIALIZE *> (&exc);
00670   if (initialize_exception != 0
00671       && minor_code < sizeof INITIALIZE_TABLE / sizeof (char *))
00672     return INITIALIZE_TABLE[minor_code];
00673 
00674   CORBA::INV_OBJREF const * inv_objref_exception =
00675     dynamic_cast <const CORBA::INV_OBJREF *> (&exc);
00676   if (inv_objref_exception != 0
00677       && minor_code < sizeof INV_OBJREF_TABLE / sizeof (char *))
00678     return INV_OBJREF_TABLE[minor_code];
00679 
00680   CORBA::MARSHAL const * marshal_exception =
00681     dynamic_cast <const CORBA::MARSHAL *> (&exc);
00682   if (marshal_exception != 0
00683       && minor_code < sizeof MARSHAL_TABLE / sizeof (char *))
00684     return MARSHAL_TABLE[minor_code];
00685 
00686   CORBA::BAD_TYPECODE const * bad_typecode_exception =
00687     dynamic_cast <const CORBA::BAD_TYPECODE *> (&exc);
00688   if (bad_typecode_exception != 0
00689       && minor_code < sizeof BAD_TYPECODE_TABLE / sizeof (char *))
00690     return BAD_TYPECODE_TABLE[minor_code];
00691 
00692   CORBA::NO_IMPLEMENT const * no_implement_exception =
00693     dynamic_cast <const CORBA::NO_IMPLEMENT *> (&exc);
00694   if (no_implement_exception != 0
00695       && minor_code < sizeof NO_IMPLEMENT_TABLE / sizeof (char *))
00696     return NO_IMPLEMENT_TABLE[minor_code];
00697 
00698   CORBA::NO_RESOURCES const * no_resource_exception =
00699     dynamic_cast <const CORBA::NO_RESOURCES *> (&exc);
00700   if (no_resource_exception != 0
00701       && minor_code < sizeof NO_RESOURCES_TABLE / sizeof (char *))
00702     return NO_RESOURCES_TABLE[minor_code];
00703 
00704   CORBA::BAD_INV_ORDER const * bad_inv_order_exception =
00705     dynamic_cast <const CORBA::BAD_INV_ORDER *> (&exc);
00706   if (bad_inv_order_exception != 0
00707       && minor_code < sizeof BAD_INV_ORDER_TABLE / sizeof (char *))
00708     return BAD_INV_ORDER_TABLE[minor_code];
00709 
00710   CORBA::TRANSIENT const * transient_exception =
00711     dynamic_cast <const CORBA::TRANSIENT *> (&exc);
00712   if (transient_exception != 0
00713       && minor_code < sizeof TRANSIENT_TABLE / sizeof (char *))
00714     return TRANSIENT_TABLE[minor_code];
00715 
00716   CORBA::OBJ_ADAPTER const * obj_adapter_exception =
00717     dynamic_cast <const CORBA::OBJ_ADAPTER *> (&exc);
00718   if (obj_adapter_exception != 0
00719       && minor_code < sizeof OBJ_ADAPTER_TABLE / sizeof (char *))
00720     return OBJ_ADAPTER_TABLE[minor_code];
00721 
00722   CORBA::DATA_CONVERSION const * data_conversion_exception =
00723     dynamic_cast <const CORBA::DATA_CONVERSION *> (&exc);
00724   if (data_conversion_exception != 0
00725       && minor_code < sizeof DATA_CONVERSION_TABLE / sizeof (char *))
00726     return DATA_CONVERSION_TABLE[minor_code];
00727 
00728   CORBA::OBJECT_NOT_EXIST const * object_not_exist_exception =
00729     dynamic_cast <const CORBA::OBJECT_NOT_EXIST *> (&exc);
00730   if (object_not_exist_exception != 0
00731       && minor_code < sizeof OBJECT_NOT_EXIST_TABLE / sizeof (char *))
00732     return OBJECT_NOT_EXIST_TABLE[minor_code];
00733 
00734   CORBA::INV_POLICY const * inv_policy_exception =
00735     dynamic_cast <const CORBA::INV_POLICY *> (&exc);
00736   if (inv_policy_exception != 0
00737       && minor_code < sizeof INV_POLICY_TABLE / sizeof (char *))
00738     return INV_POLICY_TABLE[minor_code];
00739 
00740   CORBA::ACTIVITY_COMPLETED const * activity_completed_exception =
00741     dynamic_cast <const CORBA::ACTIVITY_COMPLETED *> (&exc);
00742   if (activity_completed_exception != 0
00743       && minor_code < sizeof ACTIVITY_COMPLETED_TABLE / sizeof (char *))
00744     return ACTIVITY_COMPLETED_TABLE[minor_code];
00745 
00746   CORBA::ACTIVITY_REQUIRED const * activity_required_exception =
00747     dynamic_cast <const CORBA::ACTIVITY_REQUIRED *> (&exc);
00748   if (activity_required_exception != 0
00749       && minor_code < sizeof ACTIVITY_REQUIRED_TABLE / sizeof (char *))
00750     return ACTIVITY_REQUIRED_TABLE[minor_code];
00751 
00752   CORBA::BAD_OPERATION const * bad_operation_exception =
00753     dynamic_cast <const CORBA::BAD_OPERATION *> (&exc);
00754   if (bad_operation_exception != 0
00755       && minor_code < sizeof BAD_OPERATION_TABLE / sizeof (char *))
00756     return BAD_OPERATION_TABLE[minor_code];
00757 
00758   CORBA::BAD_CONTEXT const * bad_context_exception =
00759     dynamic_cast <const CORBA::BAD_CONTEXT *> (&exc);
00760   if (bad_context_exception != 0
00761       && minor_code < sizeof BAD_CONTEXT_TABLE / sizeof (char *))
00762     return BAD_CONTEXT_TABLE[minor_code];
00763 
00764   CORBA::CODESET_INCOMPATIBLE const * codeset_incompatible_exception =
00765     dynamic_cast <const CORBA::CODESET_INCOMPATIBLE *> (&exc);
00766   if (codeset_incompatible_exception != 0
00767       && minor_code < sizeof CODESET_INCOMPATIBLE_TABLE / sizeof (char *))
00768     return CODESET_INCOMPATIBLE_TABLE[minor_code];
00769 
00770   CORBA::INTF_REPOS const * intf_repos_exception =
00771     dynamic_cast <const CORBA::INTF_REPOS *> (&exc);
00772   if (intf_repos_exception != 0
00773       && minor_code < sizeof INTF_REPOS_TABLE / sizeof (char *))
00774     return INTF_REPOS_TABLE[minor_code];
00775 
00776 #else
00777   ACE_UNUSED_ARG (exc);
00778   ACE_UNUSED_ARG (minor_code);
00779 #endif  /* !ACE_NDEBUG */
00780 
00781   return "*unknown description*";
00782 }
00783 
00784 TAO_END_VERSIONED_NAMESPACE_DECL
00785 
00786 #if defined (THREAD_CANCELLED)
00787 #undef THREAD_CANCELLED
00788 #endif /* THREAD_CANCELLED */
00789 
00790 // List of standard/system exceptions ... used to create static
00791 // storage for their typecodes, then later to initialize that storage
00792 // using the routine above. (It's just too painful to init these
00793 // typecodes statically in all cases!)
00794 
00795 #define STANDARD_EXCEPTION_LIST \
00796     TAO_SYSTEM_EXCEPTION (UNKNOWN) \
00797     TAO_SYSTEM_EXCEPTION (BAD_PARAM) \
00798     TAO_SYSTEM_EXCEPTION (NO_MEMORY) \
00799     TAO_SYSTEM_EXCEPTION (IMP_LIMIT) \
00800     TAO_SYSTEM_EXCEPTION (COMM_FAILURE) \
00801     TAO_SYSTEM_EXCEPTION (INV_OBJREF) \
00802     TAO_SYSTEM_EXCEPTION (OBJECT_NOT_EXIST) \
00803     TAO_SYSTEM_EXCEPTION (NO_PERMISSION) \
00804     TAO_SYSTEM_EXCEPTION (INTERNAL) \
00805     TAO_SYSTEM_EXCEPTION (MARSHAL) \
00806     TAO_SYSTEM_EXCEPTION (INITIALIZE) \
00807     TAO_SYSTEM_EXCEPTION (NO_IMPLEMENT) \
00808     TAO_SYSTEM_EXCEPTION (BAD_TYPECODE) \
00809     TAO_SYSTEM_EXCEPTION (BAD_OPERATION) \
00810     TAO_SYSTEM_EXCEPTION (NO_RESOURCES) \
00811     TAO_SYSTEM_EXCEPTION (NO_RESPONSE) \
00812     TAO_SYSTEM_EXCEPTION (PERSIST_STORE) \
00813     TAO_SYSTEM_EXCEPTION (BAD_INV_ORDER) \
00814     TAO_SYSTEM_EXCEPTION (TRANSIENT) \
00815     TAO_SYSTEM_EXCEPTION (FREE_MEM) \
00816     TAO_SYSTEM_EXCEPTION (INV_IDENT) \
00817     TAO_SYSTEM_EXCEPTION (INV_FLAG) \
00818     TAO_SYSTEM_EXCEPTION (INTF_REPOS) \
00819     TAO_SYSTEM_EXCEPTION (BAD_CONTEXT) \
00820     TAO_SYSTEM_EXCEPTION (OBJ_ADAPTER) \
00821     TAO_SYSTEM_EXCEPTION (DATA_CONVERSION) \
00822     TAO_SYSTEM_EXCEPTION (INV_POLICY) \
00823     TAO_SYSTEM_EXCEPTION (REBIND) \
00824     TAO_SYSTEM_EXCEPTION (TIMEOUT) \
00825     TAO_SYSTEM_EXCEPTION (TRANSACTION_UNAVAILABLE) \
00826     TAO_SYSTEM_EXCEPTION (TRANSACTION_MODE) \
00827     TAO_SYSTEM_EXCEPTION (TRANSACTION_REQUIRED) \
00828     TAO_SYSTEM_EXCEPTION (TRANSACTION_ROLLEDBACK) \
00829     TAO_SYSTEM_EXCEPTION (INVALID_TRANSACTION) \
00830     TAO_SYSTEM_EXCEPTION (CODESET_INCOMPATIBLE) \
00831     TAO_SYSTEM_EXCEPTION (BAD_QOS) \
00832     TAO_SYSTEM_EXCEPTION (INVALID_ACTIVITY) \
00833     TAO_SYSTEM_EXCEPTION (ACTIVITY_COMPLETED) \
00834     TAO_SYSTEM_EXCEPTION (ACTIVITY_REQUIRED) \
00835     TAO_SYSTEM_EXCEPTION (THREAD_CANCELLED)
00836 
00837 static const char *repo_id_array[] = {
00838 #define TAO_SYSTEM_EXCEPTION(name) \
00839                   (char *) "IDL:omg.org/CORBA/" #name ":1.0",
00840       STANDARD_EXCEPTION_LIST
00841 #undef  TAO_SYSTEM_EXCEPTION
00842       0
00843   };
00844 
00845 // Since we add an extra element subtract 1
00846 static const CORBA::ULong array_sz =
00847   (sizeof (repo_id_array) / sizeof (char const *)) - 1;
00848 
00849 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00850 
00851 TAO::excp_factory excp_array [] = {
00852 #define TAO_SYSTEM_EXCEPTION(name) \
00853       &CORBA::name::_tao_create,
00854       STANDARD_EXCEPTION_LIST
00855 #undef  TAO_SYSTEM_EXCEPTION
00856       0
00857 };
00858 
00859 // Concrete SystemException constructors
00860 #define TAO_SYSTEM_EXCEPTION(name) \
00861 CORBA::name ::name (void) \
00862   :  CORBA::SystemException ("IDL:omg.org/CORBA/" #name ":1.0", \
00863                              #name, \
00864                              0, \
00865                              CORBA::COMPLETED_NO) \
00866 { \
00867 } \
00868 \
00869 CORBA::name ::name (CORBA::ULong code, CORBA::CompletionStatus completed) \
00870   : CORBA::SystemException ("IDL:omg.org/CORBA/" #name ":1.0", \
00871                             #name, \
00872                             code, \
00873                             completed) \
00874 { \
00875 }
00876 
00877 STANDARD_EXCEPTION_LIST
00878 #undef TAO_SYSTEM_EXCEPTION
00879 
00880 #define TAO_SYSTEM_EXCEPTION(name) \
00881 CORBA::TypeCode_ptr \
00882 CORBA::name ::_tao_type (void) const \
00883 { \
00884   return 0;                                     \
00885 }
00886 
00887 STANDARD_EXCEPTION_LIST
00888 #undef  TAO_SYSTEM_EXCEPTION
00889 
00890 CORBA::SystemException *
00891 TAO::create_system_exception (const char *id)
00892 {
00893   for (CORBA::ULong i = 0; i < array_sz; ++i)
00894     {
00895       if (ACE_OS::strcmp (id, repo_id_array[i]) == 0)
00896         return (*(excp_array[i])) ();
00897     }
00898 
00899   return 0;
00900 }
00901 
00902 #define TAO_SYSTEM_EXCEPTION(name) \
00903 void \
00904 CORBA::name ::_raise (void) const \
00905 { \
00906   throw *this; \
00907 }
00908 
00909 STANDARD_EXCEPTION_LIST
00910 #undef TAO_SYSTEM_EXCEPTION
00911 
00912 #define TAO_SYSTEM_EXCEPTION(name) \
00913 CORBA::Exception * \
00914 CORBA::name ::_tao_duplicate (void) const \
00915 { \
00916   CORBA::Exception * result = 0; \
00917   ACE_ALLOCATOR_NEW (result, CORBA::name (*this), 0); \
00918   return result; \
00919 }
00920 
00921 STANDARD_EXCEPTION_LIST
00922 #undef TAO_SYSTEM_EXCEPTION
00923 
00924 #define TAO_SYSTEM_EXCEPTION(name) \
00925 CORBA::SystemException * \
00926 CORBA::name ::_tao_create (void) \
00927 { \
00928   CORBA::name *result = 0; \
00929   ACE_ALLOCATOR_NEW (result, CORBA::name, 0); \
00930   return result; \
00931 }
00932 
00933 STANDARD_EXCEPTION_LIST
00934 #undef TAO_SYSTEM_EXCEPTION
00935 
00936 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Fri Feb 12 20:05:27 2016 for OpenDDS by  doxygen 1.4.7