//Create iterator
SALOMEDS_ChildIterator_i* it_servant = new SALOMEDS_ChildIterator_i(anItr, _orb);
- SALOMEDS::ChildIterator_var it = SALOMEDS::ChildIterator::_narrow(it_servant->_this());
- return it;
+ return it_servant->_this();
}
SALOMEDS::SComponentIterator_var itcomponent = NewComponentIterator();
for (; itcomponent->More(); itcomponent->Next()) {
SALOMEDS::SComponent_var sco = itcomponent->Value();
- MESSAGE ( "Look for an engine for data type :"<< sco->ComponentDataType());
+ CORBA::String_var compodatatype=sco->ComponentDataType();
+ MESSAGE ( "Look for an engine for data type :"<< compodatatype);
// if there is an associated Engine call its method for closing
CORBA::String_var IOREngine;
if (sco->ComponentIOR(IOREngine)) {
// we have found the associated engine to write the data
- MESSAGE ( "We have found an engine for data type :"<< sco->ComponentDataType());
- CORBA::Object_var obj = _orb->string_to_object(IOREngine);
- if (!CORBA::is_nil(obj)) {
- SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_narrow(obj) ;
-
- if (!anEngine->_is_nil()) {
- SALOMEDS::unlock();
- anEngine->Close(sco);
- SALOMEDS::lock();
- }
- }
+ MESSAGE ( "We have found an engine for data type :"<< compodatatype);
+ //_narrow can throw a corba exception
+ try
+ {
+ CORBA::Object_var obj = _orb->string_to_object(IOREngine);
+ if (!CORBA::is_nil(obj))
+ {
+ SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_narrow(obj) ;
+ if (!anEngine->_is_nil())
+ {
+ SALOMEDS::unlock();
+ anEngine->Close(sco);
+ SALOMEDS::lock();
+ }
+ }
+ }
+ catch (CORBA::Exception&)
+ {/*pass*/ }
}
}