[openrtm-commit:00103] r2132 - branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2011年 5月 24日 (火) 12:56:21 JST
Author: n-ando
Date: 2011-05-24 12:56:21 +0900 (Tue, 24 May 2011)
New Revision: 2132
Modified:
branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/PortAdmin.cpp
Log:
get_port_profile() are enclosed by try-catch, and they return false now.
refs #1776
Modified: branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/PortAdmin.cpp
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/PortAdmin.cpp 2011-05-24 03:54:30 UTC (rev 2131)
+++ branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/PortAdmin.cpp 2011-05-24 03:56:21 UTC (rev 2132)
@@ -35,16 +35,24 @@
find_port_name(const char* name) : m_name(name) {};
bool operator()(const PortService_ptr& p)
{
+ try
+ {
#ifndef ORB_IS_RTORB
- PortProfile_var prof(p->get_port_profile());
- std::string name(prof->name);
+ PortProfile_var prof(p->get_port_profile());
+ std::string name(prof->name);
#else // ORB_IS_RTORB
- PortProfile *pp;
- pp = p->get_port_profile();
- std::string name( pp->name);
- delete pp;
+ PortProfile *pp;
+ pp = p->get_port_profile();
+ std::string name( pp->name);
+ delete pp;
#endif // ORB_IS_RTORB
- return m_name == name;
+ return m_name == name;
+ }
+ catch (...)
+ {
+ return false;
+ }
+ return false;
}
const std::string m_name;
};
@@ -128,9 +136,16 @@
for (CORBA::ULong i (0); i < len; ++i)
{
- pp = m_portRefs[i]->get_port_profile();
- port_profs[i] = *(pp);
- delete pp;
+ try
+ {
+ pp = m_portRefs[i]->get_port_profile();
+ port_profs[i] = *(pp);
+ delete pp;
+ }
+ catch (...)
+ {
+ ;
+ }
}
#endif // ORB_IS_RTORB
return port_profs;
@@ -199,15 +214,24 @@
bool PortAdmin::addPort(PortService_ptr port)
{
// Check for duplicate
- PortProfile_var prof(port->get_port_profile());
- std::string name(prof->name);
+ try
+ {
+ PortProfile_var prof(port->get_port_profile());
+ std::string name(prof->name);
+
// Why RtORB delete _var object explicitly?
#ifdef ORB_IS_RTORB
- delete prof._retn();
+ delete prof._retn();
#endif
- if (CORBA_SeqUtil::find(m_portRefs, find_port_name(name.c_str())) != -1)
- return false;
-
+ if (CORBA_SeqUtil::find(m_portRefs, find_port_name(name.c_str())) != -1)
+ {
+ return false;
+ }
+ }
+ catch (...)
+ {
+ return false;
+ }
CORBA_SeqUtil::push_back(m_portRefs, RTC::PortService::_duplicate(port));
return true;
}
openrtm-commit メーリングリストの案内