Hi,

I just found brittle code in version 2.2.6 and I do not know if this version is 
still maintained or if this code is still present in 3.0. Here is the problem 
and tell me if it is still relevant:

In OpenWireConnector::createSession()

If an exception is thrown from syncRequest(),

The destructor of OpenWireSessionInfo will be called while the stack is 
unrolled. In that destructor,

BaseConnectorResource::close() throw ( cms::CMSException ) is called.

which will call

void OpenWireConnector::disposeOf(
    commands::DataStructure* objectId ) throw ( ConnectorException )

which will call oneway().

The thing is that it is very unlikely that oneway() will succeed if 
syncRequest() fail and this will abort the program since this is what happens 
when an exception slips out of a destructor while the stack is unrolling 
because of an exception.

I would propose to not let exception slip out of the destructor:

        virtual ~OpenWireSessionInfo() {
            try
            {
                this->close();
            }
            catch(...) { /*absorb*/ }
            delete sessionInfo;
        }

But I cannot find this code in 3.0. Has it been removed?

Thanks,
Olivier Langlois
C++ Technical Lead

STREAMTHEWORLD

t. 1 866 448 4037 ext. 675
t. 1 514 448 4037 ext. 675
f. 1 514 807 1861

[email protected]
streamtheworld.com
 
StreamTheWorld launches its new BlackBerry application. Learn more

Reply via email to