diff options
author | Jose <jose@zeroc.com> | 2016-01-08 21:10:14 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2016-01-08 21:10:14 +0100 |
commit | 93ab5a8f08970ad49c6f973b965b8fbefb63882f (patch) | |
tree | 18c00abdc514ca90a7ab6e1acc5b350847843681 /cpp/src/Ice/LocatorInfo.cpp | |
parent | C++98 test minor build fix (diff) | |
download | ice-93ab5a8f08970ad49c6f973b965b8fbefb63882f.tar.bz2 ice-93ab5a8f08970ad49c6f973b965b8fbefb63882f.tar.xz ice-93ab5a8f08970ad49c6f973b965b8fbefb63882f.zip |
C++11 fix Exception::ice_clone to use exception_ptr
Diffstat (limited to 'cpp/src/Ice/LocatorInfo.cpp')
-rw-r--r-- | cpp/src/Ice/LocatorInfo.cpp | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp index 9516548a5be..5581237a7cf 100644 --- a/cpp/src/Ice/LocatorInfo.cpp +++ b/cpp/src/Ice/LocatorInfo.cpp @@ -418,7 +418,7 @@ IceInternal::LocatorInfo::Request::addCallback(const ReferencePtr& ref, RequestCallbackPtr callback = new RequestCallback(ref, ttl, cb); { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor); - if(!_response && !_exception.get()) + if(!_response && !ICE_EXCEPTION_GET(_exception)) { _callbacks.push_back(callback); if(wellKnownRef) // This request is to resolve the endpoints of a cached well-known object reference @@ -441,8 +441,19 @@ IceInternal::LocatorInfo::Request::addCallback(const ReferencePtr& ref, } else { - assert(_exception.get()); + assert(ICE_EXCEPTION_GET(_exception)); +#ifdef ICE_CPP11_MAPPING + try + { + rethrow_exception(_exception); + } + catch(const Ice::LocalException& ex) + { + callback->exception(_locatorInfo, ex); + } +#else callback->exception(_locatorInfo, *_exception.get()); +#endif } } @@ -453,7 +464,7 @@ IceInternal::LocatorInfo::Request::getEndpoints(const ReferencePtr& ref, bool& cached) { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor); - if(!_response && !_exception.get()) + if(!_response && !ICE_EXCEPTION_GET(_exception)) { if(wellKnownRef) // This request is to resolve the endpoints of a cached well-known object reference { @@ -467,15 +478,26 @@ IceInternal::LocatorInfo::Request::getEndpoints(const ReferencePtr& ref, sync.acquire(); } - while(!_response && !_exception.get()) + while(!_response && !ICE_EXCEPTION_GET(_exception)) { _monitor.wait(); } } - if(_exception.get()) + if(ICE_EXCEPTION_GET(_exception)) { +#ifdef ICE_CPP11_MAPPING + try + { + rethrow_exception(_exception); + } + catch(const Ice::LocalException& ex) + { + _locatorInfo->getEndpointsException(ref, ex); // This throws. + } +#else _locatorInfo->getEndpointsException(ref, *_exception.get()); // This throws. +#endif } assert(_response); @@ -533,7 +555,11 @@ IceInternal::LocatorInfo::Request::exception(const Ice::Exception& ex) { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor); _locatorInfo->finishRequest(_ref, _wellKnownRefs, 0, dynamic_cast<const Ice::UserException*>(&ex)); +#ifdef ICE_CPP11_MAPPING + _exception = ex.ice_clone(); +#else _exception.reset(ex.ice_clone()); +#endif _monitor.notifyAll(); } for(vector<RequestCallbackPtr>::const_iterator p = _callbacks.begin(); p != _callbacks.end(); ++p) |