summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-24 19:02:10 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-24 19:02:10 +0000
commit07e8a1d00d1e2ab1c2b47e3698886f1512bcf03a (patch)
treecb2b545f66efd726c9d7da44d080706972861215
parentb652701bc2201ceaf2290d375f722653dbc0f66c (diff)
downloadATCD-07e8a1d00d1e2ab1c2b47e3698886f1512bcf03a.tar.gz
ChangeLogTag:Thu Jun 24 13:46:46 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r--TAO/ChangeLog-99c13
-rw-r--r--TAO/tao/ORB.cpp24
-rw-r--r--TAO/tao/ORB.h4
-rw-r--r--TAO/tests/Param_Test/client.cpp2
-rw-r--r--TAO/tests/Param_Test/except.cpp91
-rw-r--r--TAO/tests/Param_Test/param_test_i.cpp4
-rw-r--r--TAO/tests/Param_Test/param_test_i.h4
7 files changed, 96 insertions, 46 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c
index f40e578b01e..da4ba567081 100644
--- a/TAO/ChangeLog-99c
+++ b/TAO/ChangeLog-99c
@@ -1,3 +1,16 @@
+Thu Jun 24 13:46:46 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
+
+ * tao/ORB.h:
+ * tao/ORB.cpp:
+ Added an unexpected() function to transform unexpected
+ exceptions into CORBA::UNKNOWN
+
+ * tests/Param_Test/client.cpp:
+ * tests/Param_Test/except.cpp:
+ * tests/Param_Test/param_test_i.h:
+ * tests/Param_Test/param_test_i.cpp:
+ The test was broken but SII and DII (!) exceptions where ok.
+
Thu Jun 24 12:20:36 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
* orbsvcs/Event_Service/Event_Service.cpp:
diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp
index f00cfb52563..b5db58b67d6 100644
--- a/TAO/tao/ORB.cpp
+++ b/TAO/tao/ORB.cpp
@@ -46,6 +46,14 @@
#include "tao/Messaging_Policy_i.h"
#endif /* TAO_HAS_CORBA_MESSAGING */
+#if defined(ACE_HAS_EXCEPTIONS)
+#if defined (ACE_HAS_STANDARD_CPP_LIBRARY)
+#include /**/ <exception>
+using std::set_unexpected;
+#else
+#include /**/ <exception.h>
+#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */
+#endif /* ACE_HAS_EXCEPTIONS */
#if !defined (__ACE_INLINE__)
# include "tao/ORB.i"
@@ -1159,6 +1167,10 @@ CORBA_ORB::init_orb_globals (CORBA::Environment &ACE_TRY_ENV)
if (CORBA_ORB::orb_init_count_ == 0)
{
+#if defined(ACE_HAS_EXCEPTIONS)
+ set_unexpected (CORBA_ORB::_tao_unexpected_exception);
+#endif /* ACE_HAS_EXCEPTIONS */
+
// initialize the system TypeCodes
TAO_TypeCodes::init ();
@@ -1208,6 +1220,18 @@ CORBA_ORB::init_orb_globals (CORBA::Environment &ACE_TRY_ENV)
CORBA_ORB::orb_init_count_++;
}
+void CORBA_ORB::_tao_unexpected_exception (void)
+{
+#if defined(ACE_HAS_EXCEPTIONS)
+ throw CORBA::UNKNOWN ();
+#else
+ // Nothing to do, this will be handled by the ORB core when sending
+ // the exception back to the client...
+#endif /* ACE_HAS_EXCEPTIONS */
+}
+
+// ****************************************************************
+
// ORB initialisation, per OMG document 94-9-46.
//
diff --git a/TAO/tao/ORB.h b/TAO/tao/ORB.h
index 59d13577e91..90dd21e2960 100644
--- a/TAO/tao/ORB.h
+++ b/TAO/tao/ORB.h
@@ -591,6 +591,10 @@ public:
// Indicates if we have reached a point where all ORB owned
// resources will be deallocated.
+ // The function used by tao to handle the "unexpected" exceptions,
+ // It raises CORBA::UNKNOWN.
+ static void _tao_unexpected_exception (void);
+
// Reference counting...
virtual CORBA::ULong _incr_refcnt (void);
virtual CORBA::ULong _decr_refcnt (void);
diff --git a/TAO/tests/Param_Test/client.cpp b/TAO/tests/Param_Test/client.cpp
index 5b1c6702540..fca02ab1d5c 100644
--- a/TAO/tests/Param_Test/client.cpp
+++ b/TAO/tests/Param_Test/client.cpp
@@ -242,7 +242,7 @@ Param_Test_Client<T>::run_dii_test (void)
this->results_.error_count (this->results_.error_count () + 1);
ACE_ERROR ((LM_ERROR,
"(%N:%l) client.cpp - "
- "Invalid results in run_dii_test in iteration %d",
+ "Invalid results in run_dii_test in iteration %d\n",
i));
continue;
}
diff --git a/TAO/tests/Param_Test/except.cpp b/TAO/tests/Param_Test/except.cpp
index 2dde40d092a..ca6e0aa2bf6 100644
--- a/TAO/tests/Param_Test/except.cpp
+++ b/TAO/tests/Param_Test/except.cpp
@@ -52,26 +52,44 @@ Test_Exception::dii_req_invoke (CORBA::Request *req,
req->invoke (ACE_TRY_ENV);
ACE_TRY_CHECK;
}
- ACE_CATCH (Param_Test::Ooops, ex)
+ ACE_CATCH (CORBA::UnknownUserException, user_ex)
{
- if (TAO_debug_level > 0)
+ Param_Test::Ooops* oops;
+ Param_Test::BadBoy* bad_boy;
+
+ if (user_ex.exception () >>= oops)
+ {
+ if (TAO_debug_level > 0)
+ {
+ const char *reason = oops->reason.in ();
+ if (reason == 0)
+ reason = "nil";
+ ACE_DEBUG ((LM_DEBUG,
+ "Test_Exception::dii_req_invoke - "
+ "expected user exception"
+ " (%s,%d)\n", reason, oops->input));
+ }
+ this->inout_ = this->in_ * 2;
+ this->out_ = this->in_ * 3;
+ this->ret_ = this->in_ * 4;
+ return;
+ }
+ else if (user_ex.exception () >>= bad_boy)
+ {
+ ACE_PRINT_EXCEPTION ((*bad_boy),
+ "Test_Exception::dii_req_invoke - "
+ "unexpected (but known) user exception\n");
+ this->inout_ = this->in_ * 5;
+ this->out_ = this->in_ * 5;
+ this->ret_ = this->in_ * 5;
+ }
+ else
{
- const char *reason = ex.reason.in ();
- if (reason == 0)
- reason = "nil";
ACE_DEBUG ((LM_DEBUG,
- "Test_Exception::run_sii_test - "
- "expected user exception"
- " (%s,%d)\n", reason, ex.input));
+ "Test_Exception::dii_req_invoke - "
+ "unexpected (and unknown) user exception\n"));
}
- this->inout_ = this->in_ * 3;
- this->out_ = this->in_ * 4;
- this->ret_ = this->in_ * 5;
-
- // Why should we use clear ?????
- //TAO_TRY_ENV.clear ();
- return;
}
ACE_CATCH (CORBA::UNKNOWN, ex)
{
@@ -80,20 +98,12 @@ Test_Exception::dii_req_invoke (CORBA::Request *req,
ACE_PRINT_EXCEPTION (ex,"Test_Exception::run_sii_test - "
"expected system exception\n");
}
- this->inout_ = this->in_ * 4;
- this->out_ = this->in_ * 5;
- this->ret_ = this->in_ * 6;
-
- // TAO_TRY_ENV.clear ();
+ this->inout_ = this->in_ * 2;
+ this->out_ = this->in_ * 3;
+ this->ret_ = this->in_ * 4;
return;
}
- ACE_CATCH (Param_Test::BadBoy, ex)
- {
- ACE_PRINT_EXCEPTION (ex, "Test_Exception::run_sii_test - "
- " unexpected exception\n");
- ACE_TRY_THROW (Param_Test::BadBoy ());
- }
ACE_ENDTRY;
ACE_CHECK;
}
@@ -124,6 +134,7 @@ Test_Exception::run_sii_test (Param_Test_ptr objref,
{
ACE_TRY
{
+ this->in_++;
this->ret_ = objref->test_exception (this->in_,
this->inout_,
this->out_,
@@ -142,25 +153,28 @@ Test_Exception::run_sii_test (Param_Test_ptr objref,
"expected user exception"
" (%s,%d)\n", reason, ex.input));
}
- this->inout_ = this->in_ * 3;
- this->out_ = this->in_ * 4;
- this->ret_ = this->in_ * 5;
+ this->inout_ = this->in_ * 2;
+ this->out_ = this->in_ * 3;
+ this->ret_ = this->in_ * 4;
return -1;
}
ACE_CATCH (CORBA::UNKNOWN, ex)
{
if (TAO_debug_level > 0)
{
- ACE_PRINT_EXCEPTION (ex,"Test_Exception::run_sii_test - expected system exception\n");
+ ACE_PRINT_EXCEPTION (ex,"Test_Exception::run_sii_test - "
+ "expected system exception\n");
}
- this->inout_ = this->in_ * 4;
- this->out_ = this->in_ * 5;
- this->ret_ = this->in_ * 6;
- return -1;
+ this->inout_ = this->in_ * 2;
+ this->out_ = this->in_ * 3;
+ this->ret_ = this->in_ * 4;
+ return 0;
}
ACE_CATCH (Param_Test::BadBoy, ex)
{
- ACE_PRINT_EXCEPTION (ex,"Test_Exception::run_sii_test - unexpected system exception\n");
+ ACE_PRINT_EXCEPTION (ex,
+ "Test_Exception::run_sii_test - "
+ "unexpected user exception\n");
return -1;
}
ACE_ENDTRY;
@@ -215,10 +229,9 @@ Test_Exception::add_args (CORBA::NVList_ptr param_list,
CORBA::Boolean
Test_Exception::check_validity (void)
{
- CORBA::ULong n = (this->iterations_++) % 3;
- if (this->inout_ == this->in_ * (n + 2) &&
- this->out_ == this->in_ * (n + 3) &&
- this->ret_ == this->in_ * (n + 4))
+ if (this->inout_ == this->in_ * 2 &&
+ this->out_ == this->in_ * 3 &&
+ this->ret_ == this->in_ * 4)
return 1;
return 0;
}
diff --git a/TAO/tests/Param_Test/param_test_i.cpp b/TAO/tests/Param_Test/param_test_i.cpp
index 692e43cd8eb..ac068c3b6af 100644
--- a/TAO/tests/Param_Test/param_test_i.cpp
+++ b/TAO/tests/Param_Test/param_test_i.cpp
@@ -795,8 +795,7 @@ Param_Test_i::test_exception (CORBA::ULong s1,
ACE_THROW_SPEC ((CORBA::SystemException,
Param_Test::Ooops))
{
- int d = this->test_exception_count_ % 3;
- this->test_exception_count_++;
+ int d = s1 % 3;
if (d == 0)
{
s2 = s1 * 2;
@@ -805,6 +804,7 @@ Param_Test_i::test_exception (CORBA::ULong s1,
}
else if (d == 1)
ACE_THROW_RETURN (Param_Test::Ooops (CORBA::string_dup (" % 3 == 1"), s1), 0);
+
ACE_THROW_RETURN (Param_Test::BadBoy (), 0);
}
diff --git a/TAO/tests/Param_Test/param_test_i.h b/TAO/tests/Param_Test/param_test_i.h
index ce378a917b6..cdf667e8d9a 100644
--- a/TAO/tests/Param_Test/param_test_i.h
+++ b/TAO/tests/Param_Test/param_test_i.h
@@ -288,10 +288,6 @@ private:
Coffee_i obj_;
// the coffee object reference we maintain
-
- int test_exception_count_;
- // Count the number of calls to test_exception() so we can throw
- // every 3 calls or so.
};
#endif /* PARAM_TEST_I_H */