SystemException.cpp

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

Generated on Thu Nov 9 11:54:23 2006 for TAO by doxygen 1.3.6