summaryrefslogtreecommitdiff
path: root/TAO/tao/Server_Request.cpp
diff options
context:
space:
mode:
authormk1 <mk1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-12 02:18:02 +0000
committermk1 <mk1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-12 02:18:02 +0000
commit48dfd3ac0bbaaa5091260859e2e79ae01b176664 (patch)
tree6947004db5f4bc6b78119c9cc0ea93fd822bd179 /TAO/tao/Server_Request.cpp
parenta01d0b8ea55bedb117b5f9786f7733f54482f352 (diff)
downloadATCD-48dfd3ac0bbaaa5091260859e2e79ae01b176664.tar.gz
ChangeLog entry: Thu Jun 11 21:15:00 1998 Michael Kircher <mk1@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/Server_Request.cpp')
-rw-r--r--TAO/tao/Server_Request.cpp61
1 files changed, 43 insertions, 18 deletions
diff --git a/TAO/tao/Server_Request.cpp b/TAO/tao/Server_Request.cpp
index aa419b2f246..f64b038e4ec 100644
--- a/TAO/tao/Server_Request.cpp
+++ b/TAO/tao/Server_Request.cpp
@@ -297,18 +297,32 @@ IIOP_ServerRequest::set_exception (const CORBA::Any &value,
if (this->retval_ || this->exception_)
env.exception (new CORBA::BAD_INV_ORDER (CORBA::COMPLETED_NO));
else
+ {
+ // Try to narrow to ForwardRequest
+ PortableServer::ForwardRequest_ptr forward_request =
+ PortableServer::ForwardRequest::_narrow ((CORBA::Exception *) value.value ());
+
+ // If narrowing of exception succeeded
+ if (forward_request != 0)
{
- this->exception_ = new CORBA::Any;
- this->exception_->replace (value.type (), value.value (), 1, env);
-
- // @@ This cast is not safe, but we haven't implemented the >>=
- // and <<= operators for base exceptions (yet).
- CORBA_Exception* x = (CORBA_Exception*)value.value ();
- if (CORBA_UserException::_narrow (x) != 0)
- this->exception_type_ = TAO_GIOP_USER_EXCEPTION;
+ this->forward_location_ = forward_request->forward_reference;
+ }
+
+ // Normal exception
+ else
+ {
+ this->exception_ = new CORBA::Any;
+ this->exception_->replace (value.type (), value.value (), 1, env);
+
+ // @@ This cast is not safe, but we haven't implemented the >>=
+ // and <<= operators for base exceptions (yet).
+ CORBA_Exception* x = (CORBA_Exception*)value.value ();
+ if (CORBA_UserException::_narrow (x) != 0)
+ this->exception_type_ = TAO_GIOP_USER_EXCEPTION;
else
- this->exception_type_ = TAO_GIOP_SYSTEM_EXCEPTION;
- }
+ this->exception_type_ = TAO_GIOP_SYSTEM_EXCEPTION;
+ }
+ }
}
// Extension
@@ -434,15 +448,25 @@ IIOP_ServerRequest::init_reply (CORBA::Environment &env)
env);
this->outgoing_->write_ulong (this->request_id_);
- // Standard exceptions only.
- if (env.exception () != 0)
+ // Standard exceptions are caught in Connect::handle_input
+
+ // Forward exception only.
+ if (!CORBA::is_nil (this->forward_location_.in ()))
{
- CORBA::Environment env2;
- CORBA::Exception *x = env.exception ();
- CORBA::TypeCode_ptr except_tc = x->_type ();
+ this->outgoing_->write_ulong (TAO_GIOP_LOCATION_FORWARD);
+
+ CORBA::Object_ptr object_ptr = this->forward_location_.in ();
+ (void) this->outgoing_->encode (CORBA::_tc_Object,
+ &object_ptr,
+ 0,
+ env);
- this->outgoing_->write_ulong (TAO_GIOP_SYSTEM_EXCEPTION);
- (void) this->outgoing_->encode (except_tc, x, 0, env2);
+ // If encoding went fine
+ if (env.exception () != 0)
+ {
+ dexc (env, "ServerRequest::marshal - forwarding parameter encode failed");
+ return;
+ }
}
// Any exception at all.
@@ -487,7 +511,8 @@ IIOP_ServerRequest::dsi_marshal (CORBA::Environment &env)
const void *value;
// only if there wasn't any exception, we proceed
- if (this->exception_type_ == TAO_GIOP_NO_EXCEPTION)
+ if (this->exception_type_ == TAO_GIOP_NO_EXCEPTION &&
+ CORBA::is_nil (this->forward_location_.in ()))
{
// ... then send any return value ...
if (this->retval_)