SystemException.cpp

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

Generated on Tue Feb 2 17:37:52 2010 for TAO by  doxygen 1.4.7