diff options
20 files changed, 259 insertions, 82 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 1a957000aa1..66f54fe2173 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,35 @@ +Sat Feb 24 06:56:12 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl> + + * tao/AnyTypeCode/Any_Impl_T.cpp: + * tao/AnyTypeCode/Any_Special_Impl_T.cpp: + * tao/AnyTypeCode/Any_SystemException.cpp: + Use false instead of 0 + + * tao/AnyTypeCode/ExceptionA.cpp: + * tao/LocateRequest_Invocation.cpp: + * tao/PortableServer/Adapter_Activator.cpp: + Layout change + + * tao/EndpointPolicy/EndpointPolicy_ORBInitializer.cpp: + * tao/HTTP_Parser.cpp: + * tao/IFR_Client/IFR_Client_Adapter_Impl.cpp: + * tao/LocateRequest_Invocation_Adapter.cpp: + * tao/Messaging/Messaging_ORBInitializer.cpp: + * tao/PI/PI_ORBInitializer.cpp: + * tao/PI_Server/PortableServer_ORBInitializer.cpp: + * tao/PortableServer/Collocated_Object_Proxy_Broker.cpp: + * tao/RTCORBA/RT_ORBInitializer.cpp: + Removed not needed catch + + * tao/Object.cpp: + Fixed _validate_connection + + * tests/Bug_2826_Regression/*: + New regression for bug 2826 that is about a problem with + validate_connection. Thanks to Steven Xie + <steven dot xie at mpathix dot com> for reporting this + and making the test program + Thu Feb 22 09:35:00 UTC 2007 Simon Massey <sma@prismtech.com> * orbsvcs/orbsvcs/GSSUP.idl: diff --git a/TAO/tao/AnyTypeCode/Any_Impl_T.cpp b/TAO/tao/AnyTypeCode/Any_Impl_T.cpp index cbc2c916248..332298de8c1 100644 --- a/TAO/tao/AnyTypeCode/Any_Impl_T.cpp +++ b/TAO/tao/AnyTypeCode/Any_Impl_T.cpp @@ -119,7 +119,7 @@ TAO::Any_Impl_T<T>::extract (const CORBA::Any & any, { } - return 0; + return false; } template<typename T> diff --git a/TAO/tao/AnyTypeCode/Any_Special_Impl_T.cpp b/TAO/tao/AnyTypeCode/Any_Special_Impl_T.cpp index 6e24d8cb3c7..9f6fb90199d 100644 --- a/TAO/tao/AnyTypeCode/Any_Special_Impl_T.cpp +++ b/TAO/tao/AnyTypeCode/Any_Special_Impl_T.cpp @@ -162,7 +162,7 @@ TAO::Any_Special_Impl_T<T, from_T, to_T>::extract (const CORBA::Any & any, { } - return 0; + return false; } template<typename T, typename from_T, typename to_T> diff --git a/TAO/tao/AnyTypeCode/Any_SystemException.cpp b/TAO/tao/AnyTypeCode/Any_SystemException.cpp index c4a1dc5a7c7..8c9853c44b0 100644 --- a/TAO/tao/AnyTypeCode/Any_SystemException.cpp +++ b/TAO/tao/AnyTypeCode/Any_SystemException.cpp @@ -146,7 +146,7 @@ TAO::Any_SystemException::extract (const CORBA::Any & any, { } - return 0; + return false; } void diff --git a/TAO/tao/AnyTypeCode/ExceptionA.cpp b/TAO/tao/AnyTypeCode/ExceptionA.cpp index 9262c68de33..c2401c10a9b 100644 --- a/TAO/tao/AnyTypeCode/ExceptionA.cpp +++ b/TAO/tao/AnyTypeCode/ExceptionA.cpp @@ -39,8 +39,7 @@ namespace TAO { try { - this->value_->_tao_encode (cdr - ); + this->value_->_tao_encode (cdr); return true; } diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.cpp b/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.cpp index 82f8f77d499..ea00901c563 100644 --- a/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.cpp +++ b/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.cpp @@ -69,11 +69,6 @@ TAO_EndpointPolicy_ORBInitializer::register_policy_factories ( } throw; } - catch (const ::CORBA::Exception&) - { - // Rethrow any other exceptions... - throw; - } } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/HTTP_Parser.cpp b/TAO/tao/HTTP_Parser.cpp index 9cc6d00e739..b5f02f0ee3f 100644 --- a/TAO/tao/HTTP_Parser.cpp +++ b/TAO/tao/HTTP_Parser.cpp @@ -119,17 +119,7 @@ TAO_HTTP_Parser::parse_string (const char *ior, for (ACE_Message_Block * curr = mb; curr != 0; curr = curr->cont ()) string += curr->rd_ptr(); - CORBA::Object_ptr object = CORBA::Object::_nil (); - try - { - object = orb->string_to_object (string.c_str()); - } - catch (const ::CORBA::Exception&) - { - throw; - } - - return object; + return orb->string_to_object (string.c_str()); } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/IFR_Client/IFR_Client_Adapter_Impl.cpp b/TAO/tao/IFR_Client/IFR_Client_Adapter_Impl.cpp index 7c3c5cc67a8..b027a4dcee3 100644 --- a/TAO/tao/IFR_Client/IFR_Client_Adapter_Impl.cpp +++ b/TAO/tao/IFR_Client/IFR_Client_Adapter_Impl.cpp @@ -132,10 +132,6 @@ TAO_IFR_Client_Adapter_Impl::get_interface_remote ( { return CORBA::InterfaceDef::_nil (); } - catch (const ::CORBA::Exception&) - { - throw; - } return _tao_retval.retn (); } diff --git a/TAO/tao/LocateRequest_Invocation.cpp b/TAO/tao/LocateRequest_Invocation.cpp index 5e485ababd6..6611730e9a8 100644 --- a/TAO/tao/LocateRequest_Invocation.cpp +++ b/TAO/tao/LocateRequest_Invocation.cpp @@ -109,8 +109,7 @@ namespace TAO throw ::CORBA::OBJECT_NOT_EXIST (TAO::VMCID, CORBA::COMPLETED_YES); case TAO_GIOP_OBJECT_FORWARD: case TAO_GIOP_OBJECT_FORWARD_PERM: - return this->location_forward (cdr - ); + return this->location_forward (cdr); case TAO_GIOP_LOC_SYSTEM_EXCEPTION: { diff --git a/TAO/tao/LocateRequest_Invocation_Adapter.cpp b/TAO/tao/LocateRequest_Invocation_Adapter.cpp index d43fc291c97..c37d24c319b 100644 --- a/TAO/tao/LocateRequest_Invocation_Adapter.cpp +++ b/TAO/tao/LocateRequest_Invocation_Adapter.cpp @@ -83,10 +83,6 @@ namespace TAO resolver.steal_inconsistent_policies (); throw; } - catch (const ::CORBA::Exception&) - { - throw; - } } return; diff --git a/TAO/tao/Messaging/Messaging_ORBInitializer.cpp b/TAO/tao/Messaging/Messaging_ORBInitializer.cpp index 12bffa243dc..98beb835500 100644 --- a/TAO/tao/Messaging/Messaging_ORBInitializer.cpp +++ b/TAO/tao/Messaging/Messaging_ORBInitializer.cpp @@ -158,11 +158,6 @@ TAO_Messaging_ORBInitializer::register_policy_factories ( } throw; } - catch (const ::CORBA::Exception&) - { - // Rethrow any other exceptions... - throw; - } } } diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp index d3ee0bb6d60..205983dc9c5 100644 --- a/TAO/tao/Object.cpp +++ b/TAO/tao/Object.cpp @@ -475,10 +475,6 @@ CORBA::Object::_non_existent (void) { retval = true; } - catch (const ::CORBA::Exception&) - { - throw; - } return retval; } @@ -556,8 +552,7 @@ CORBA::Object::_set_policy_overrides ( throw ::CORBA::NO_IMPLEMENT (); TAO_Stub* stub = - this->protocol_proxy_->set_policy_overrides (policies, - set_add); + this->protocol_proxy_->set_policy_overrides (policies, set_add); TAO_Stub_Auto_Ptr safe_stub (stub); @@ -601,14 +596,15 @@ CORBA::Object::_validate_connection ( TAO_OBJECT_IOR_EVALUATE_RETURN; inconsistent_policies = 0; - - CORBA::Boolean retval = false; + CORBA::Boolean retval = true; #if (TAO_HAS_MINIMUM_CORBA == 0) - // If the object is collocated then use non_existent to see whether - // it's there. + // Note that the OBJECT_NOT_EXIST exception should be propagated to + // the caller rather than return false, which is why we do not use + // CORBA::Object::_non_existent(). This behavior is consistent + // with the non-collocated case. if (this->_is_collocated ()) - return !(this->_non_existent ()); + return !(this->proxy_broker ()->_non_existent (this)); TAO::LocateRequest_Invocation_Adapter tao_call (this); try @@ -620,12 +616,8 @@ CORBA::Object::_validate_connection ( inconsistent_policies = tao_call.get_inconsistent_policies (); retval = false; } - catch (const ::CORBA::Exception&) - { - throw; - } - - retval = true; +#else + retval = false; #endif /* TAO_HAS_MINIMUM_CORBA */ return retval; diff --git a/TAO/tao/PI/PI_ORBInitializer.cpp b/TAO/tao/PI/PI_ORBInitializer.cpp index 7bdbbea5343..9ba41f28778 100644 --- a/TAO/tao/PI/PI_ORBInitializer.cpp +++ b/TAO/tao/PI/PI_ORBInitializer.cpp @@ -79,11 +79,6 @@ TAO_PI_ORBInitializer::register_policy_factories ( } throw; } - catch (const ::CORBA::Exception&) - { - // Rethrow any other exceptions... - throw; - } } } diff --git a/TAO/tao/PI_Server/PortableServer_ORBInitializer.cpp b/TAO/tao/PI_Server/PortableServer_ORBInitializer.cpp index 863b6eeca11..827ac975c0d 100644 --- a/TAO/tao/PI_Server/PortableServer_ORBInitializer.cpp +++ b/TAO/tao/PI_Server/PortableServer_ORBInitializer.cpp @@ -84,11 +84,6 @@ TAO_PortableServer_ORBInitializer::register_policy_factories ( } throw; } - catch (const ::CORBA::Exception&) - { - // Rethrow any other exceptions... - throw; - } } #else ACE_UNUSED_ARG (info); diff --git a/TAO/tao/PortableServer/Adapter_Activator.cpp b/TAO/tao/PortableServer/Adapter_Activator.cpp index ef3c3cac095..32981d41e67 100644 --- a/TAO/tao/PortableServer/Adapter_Activator.cpp +++ b/TAO/tao/PortableServer/Adapter_Activator.cpp @@ -44,8 +44,7 @@ namespace TAO } catch (const ::CORBA::Exception&) { - (void) child->destroy (1, - 1); + (void) child->destroy (1, 1); return false; } diff --git a/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp b/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp index e61e6b46315..d064dc51e57 100644 --- a/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp +++ b/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp @@ -90,10 +90,6 @@ namespace TAO { // Ignore this exception. } - catch (const ::CORBA::Exception&) - { - throw; - } return _tao_retval; } @@ -168,10 +164,6 @@ namespace TAO { // Ignore this exception. } - catch (const ::CORBA::Exception&) - { - throw; - } return _tao_retval._retn (); } @@ -215,10 +207,6 @@ namespace TAO { // Ignore this exception. } - catch (const ::CORBA::Exception&) - { - throw; - } return _tao_retval; } diff --git a/TAO/tao/RTCORBA/RT_ORBInitializer.cpp b/TAO/tao/RTCORBA/RT_ORBInitializer.cpp index 9eef8d09122..90d7614d6d8 100644 --- a/TAO/tao/RTCORBA/RT_ORBInitializer.cpp +++ b/TAO/tao/RTCORBA/RT_ORBInitializer.cpp @@ -265,11 +265,6 @@ TAO_RT_ORBInitializer::register_policy_factories ( } throw; } - catch (const ::CORBA::Exception&) - { - // Rethrow any other exceptions... - throw; - } } } diff --git a/TAO/tests/Bug_2826_Regression/bug_2826_regression.cpp b/TAO/tests/Bug_2826_Regression/bug_2826_regression.cpp new file mode 100644 index 00000000000..7b6d2a95ae1 --- /dev/null +++ b/TAO/tests/Bug_2826_Regression/bug_2826_regression.cpp @@ -0,0 +1,174 @@ + + + + + + +// $Id$ + +#include "tao/ORB_Core.h" +#include "tao/PortableServer/PortableServer.h" +#include "fooS.h" + +ACE_RCSID (Bug_2826_Regression, + bug_2826_regression, + "$Id$") +namespace +{ +class Foo_i : public virtual POA_foo +{ +public: + virtual void check () + { + ACE_DEBUG ((LM_DEBUG, "(%P|%t) checking \n")); + } +}; + +int vc_check(foo_ptr ff, bool active=true) +{ + try + { + CORBA::PolicyList_var policies; + CORBA::Boolean rv=ff->_validate_connection (policies.out()); + if (!rv) + { + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) got false from _validate_connection\n"), + 1); + } + } + catch (const CORBA::INV_POLICY&) + { + if (!active) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) unexpect inlaid policies\n"), + 2); + } + catch (const CORBA::OBJECT_NOT_EXIST&) + { + if (active) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) unexpect object not exists\n"), + 3); + } + catch (const CORBA::Exception&) + { + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) unexpect exception\n"), + 4); + } + return 0; +} +}; + +int main (int argc, char *argv[]) +{ + CORBA::ORB_var orb; + try + { + orb= CORBA::ORB_init (argc, argv, 0); + + CORBA::Object_var root_poa_o = + orb->resolve_initial_references ("RootPOA"); + + PortableServer::POA_var rootPOA = + PortableServer::POA::_narrow (root_poa_o.in ()); + + if (CORBA::is_nil (rootPOA.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), 1); + } + + PortableServer::POAManager_var poaMgr = rootPOA->the_POAManager (); + + poaMgr->activate (); + + CORBA::PolicyList policies; + policies.length (3); + policies[0] = rootPOA->create_id_assignment_policy ( + PortableServer::SYSTEM_ID); + policies[1] = rootPOA->create_implicit_activation_policy ( + PortableServer::NO_IMPLICIT_ACTIVATION); + policies[2] = rootPOA->create_lifespan_policy ( + PortableServer::TRANSIENT); + + PortableServer::POA_var fooPoa = rootPOA->create_POA ( + "FOO_POA", poaMgr.in (), policies ); + + for (CORBA::ULong i = 0; i < policies.length (); ++i) + { + policies[i]->destroy (); + } + + Foo_i servant; + PortableServer::ObjectId_var oid = fooPoa->activate_object( &servant ); + + CORBA::Object_var obj = fooPoa->id_to_reference (oid.in ()); + + foo_var client = foo::_narrow (obj.in()); + + client->check(); + + if (vc_check(client.in())) + { + orb->destroy(); + return 1; + } + + fooPoa->deactivate_object (oid.in () ); //servant is gone + + if (vc_check(client.in(), false)) //exception expected + { + orb->destroy(); + return 2; + } + } + catch(...) + { + return 3; + } + return 0; +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TAO/tests/Bug_2826_Regression/foo.idl b/TAO/tests/Bug_2826_Regression/foo.idl new file mode 100644 index 00000000000..7ad6dd968c5 --- /dev/null +++ b/TAO/tests/Bug_2826_Regression/foo.idl @@ -0,0 +1,6 @@ +// $Id$ + +interface foo +{ + void check(); +}; diff --git a/TAO/tests/Bug_2826_Regression/run_test.pl b/TAO/tests/Bug_2826_Regression/run_test.pl new file mode 100755 index 00000000000..198df68c1dd --- /dev/null +++ b/TAO/tests/Bug_2826_Regression/run_test.pl @@ -0,0 +1,31 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::Run_Test; + +$status = 0; + +if (PerlACE::is_vxworks_test()) { + $SV = new PerlACE::ProcessVX ("server"); +} +else { + $SV = new PerlACE::Process ("server"); +} + +$SV->Spawn (); + +$server = $SV->WaitKill (10); + +if ($server != 0) { + print STDERR "ERROR: server returned $server\n"; + $status = 1; +} + +unlink $iorfile; + +exit $status; |