summaryrefslogtreecommitdiff
path: root/TAO/tao/EndpointPolicy
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2007-02-26 23:48:49 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2007-02-26 23:48:49 +0000
commit72d25451e85add56fffe761eda70c26ddcc55caa (patch)
treef5d490eb403a6367ca34d39b065a8bceee3f4d0c /TAO/tao/EndpointPolicy
parent2a922cde379d5f974e40111f6dff6fa7921dc3c1 (diff)
downloadATCD-72d25451e85add56fffe761eda70c26ddcc55caa.tar.gz
ChangeLogTag:Mon Feb 26 23:27:03 UTC 2007 Ossama Othman <ossama_othman at symantec dot com>
Diffstat (limited to 'TAO/tao/EndpointPolicy')
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp85
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.cpp4
2 files changed, 49 insertions, 40 deletions
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp b/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp
index b0d51bbd0f6..4174b4b2202 100644
--- a/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp
+++ b/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp
@@ -22,7 +22,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL
TAO_EndpointPolicy_Factory::TAO_EndpointPolicy_Factory (TAO_ORB_Core * orb_core)
-: orb_core_ (orb_core)
+ : orb_core_ (orb_core)
{
}
@@ -33,52 +33,57 @@ TAO_EndpointPolicy_Factory::create_policy (
const CORBA::Any &value)
{
if (type == EndpointPolicy::ENDPOINT_POLICY_TYPE)
- {
- const EndpointPolicy::EndpointList* endpoint_list;
- if ((value >>= endpoint_list) == 0)
- throw ::CORBA::PolicyError (CORBA::BAD_POLICY_VALUE);
-
- TAO_Acceptor_Registry & registry
- = this->orb_core_->lane_resources ().acceptor_registry ();
-
- TAO_Acceptor ** acceptors_begin = registry.begin ();
- TAO_Acceptor ** acceptors_end = registry.end ();
- CORBA::ULong num_eps = endpoint_list->length ();
+ {
+ const EndpointPolicy::EndpointList* endpoint_list;
+ if (!(value >>= endpoint_list))
+ throw ::CORBA::PolicyError (CORBA::BAD_POLICY_VALUE);
- // The endpoint list in the value is validated to ensure that
- // at least one endpoint in the list matches an endpoint the
- // ORB is listening on.
+ TAO_Acceptor_Registry & registry =
+ this->orb_core_->lane_resources ().acceptor_registry ();
- bool found_one = false;
- for (CORBA::ULong idx = 0; !found_one && idx < num_eps; ++idx)
- {
- CORBA::ULong prot_tag = (*endpoint_list)[idx]->protocol_tag();
+ TAO_Acceptor ** const acceptors_begin = registry.begin ();
+ TAO_Acceptor ** const acceptors_end = registry.end ();
+ CORBA::ULong const num_eps = endpoint_list->length ();
- const TAO_Endpoint_Value_Impl *evi =
- dynamic_cast <const TAO_Endpoint_Value_Impl*> ((*endpoint_list)[idx]);
+ // The endpoint list in the value is validated to ensure that
+ // at least one endpoint in the list matches an endpoint the
+ // ORB is listening on.
- for (TAO_Acceptor** acceptor = acceptors_begin;
- !found_one && acceptor != acceptors_end;
- ++acceptor)
+ bool found_one = false;
+ for (CORBA::ULong idx = 0; !found_one && idx < num_eps; ++idx)
{
- if ((*acceptor)->tag() == prot_tag)
- found_one = evi->validate_acceptor(*acceptor);
+ CORBA::ULong prot_tag = (*endpoint_list)[idx]->protocol_tag();
+
+ TAO_Endpoint_Value_Impl const * const evi =
+ dynamic_cast <TAO_Endpoint_Value_Impl const *> (
+ (*endpoint_list)[idx].in ());
+
+ if (!evi)
+ continue;
+
+ for (TAO_Acceptor** acceptor = acceptors_begin;
+ !found_one && acceptor != acceptors_end;
+ ++acceptor)
+ {
+ if ((*acceptor)->tag () == prot_tag)
+ found_one = evi->validate_acceptor (*acceptor);
+ }
}
+
+ // There is no endpoint policy value matches an endpoint the ORB
+ // is listening on. A CORBA::PolicyError exception with a
+ // PolicyErrorCode of UNSUPPORTED_POLICY_VALUE is raised.
+ if (!found_one)
+ throw ::CORBA::PolicyError (CORBA::UNSUPPORTED_POLICY_VALUE);
+
+ TAO_EndpointPolicy_i *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_EndpointPolicy_i (*endpoint_list),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+
+ return tmp;
}
- // There is no endpoint policy value matches an endpoint the ORB
- // is listening on. A CORBA::PolicyError exception with a
- // PolicyErrorCode of UNSUPPORTED_POLICY_VALUE is raised.
- if (!found_one)
- throw ::CORBA::PolicyError (CORBA::UNSUPPORTED_POLICY_VALUE);
-
- TAO_EndpointPolicy_i *tmp = 0;
- ACE_NEW_THROW_EX (tmp,
- TAO_EndpointPolicy_i (*endpoint_list),
- CORBA::NO_MEMORY (TAO::VMCID,
- CORBA::COMPLETED_NO));
-
- return tmp;
- }
else
throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE);
}
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.cpp b/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.cpp
index ea00901c563..9c8da8144ca 100644
--- a/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.cpp
+++ b/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.cpp
@@ -35,6 +35,10 @@ TAO_EndpointPolicy_ORBInitializer::register_policy_factories (
)
{
TAO_ORBInitInfo * local_info = dynamic_cast <TAO_ORBInitInfo *> (info);
+
+ if (!local_info)
+ ACE_THROW (CORBA::INTERNAL ());
+
TAO_ORB_Core * the_orb_core = local_info->orb_core ();
// Register the EndpointPolicy policy factories.