diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2007-06-19 16:26:19 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2007-06-19 16:26:19 -0230 |
commit | 6653c4246966ad65a871f8e55aab087f98b34dd9 (patch) | |
tree | 2f6c238ae05e34100ef45e6c7c60e9f756eebd09 /cpp/src | |
parent | For UDP multicast bind to the multicast address rather than 0.0.0.0 unless on... (diff) | |
download | ice-6653c4246966ad65a871f8e55aab087f98b34dd9.tar.bz2 ice-6653c4246966ad65a871f8e55aab087f98b34dd9.tar.xz ice-6653c4246966ad65a871f8e55aab087f98b34dd9.zip |
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=2140 - Remove code no longer required nowa
that IceUtil::Exception inherits from std::exception
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Freeze/BackgroundSaveEvictorI.cpp | 9 | ||||
-rw-r--r-- | cpp/src/Ice/Application.cpp | 43 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectionFactory.cpp | 7 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectionI.cpp | 7 | ||||
-rw-r--r-- | cpp/src/Ice/Incoming.cpp | 50 | ||||
-rw-r--r-- | cpp/src/Ice/IncomingAsync.cpp | 41 | ||||
-rw-r--r-- | cpp/src/Ice/Object.cpp | 8 | ||||
-rw-r--r-- | cpp/src/Ice/OutgoingAsync.cpp | 35 | ||||
-rwxr-xr-x | cpp/src/Ice/Service.cpp | 8 | ||||
-rw-r--r-- | cpp/src/Ice/ThreadPool.cpp | 8 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 21 |
11 files changed, 43 insertions, 194 deletions
diff --git a/cpp/src/Freeze/BackgroundSaveEvictorI.cpp b/cpp/src/Freeze/BackgroundSaveEvictorI.cpp index b047ae4ed47..0b0273fe2c5 100644 --- a/cpp/src/Freeze/BackgroundSaveEvictorI.cpp +++ b/cpp/src/Freeze/BackgroundSaveEvictorI.cpp @@ -1206,17 +1206,10 @@ Freeze::BackgroundSaveEvictorI::run() } } } - catch(const IceUtil::Exception& ex) - { - Error out(_communicator->getLogger()); - out << "Saving thread killed by exception: " << ex; - out.flush(); - handleFatalError(this, _communicator); - } catch(const std::exception& ex) { Error out(_communicator->getLogger()); - out << "Saving thread killed by std::exception: " << ex.what(); + out << "Saving thread killed by exception: " << ex.what(); out.flush(); handleFatalError(this, _communicator); } diff --git a/cpp/src/Ice/Application.cpp b/cpp/src/Ice/Application.cpp index 018400a5579..bb5b16588e1 100644 --- a/cpp/src/Ice/Application.cpp +++ b/cpp/src/Ice/Application.cpp @@ -121,11 +121,6 @@ destroyOnInterruptCallback(int signal) { _communicator->destroy(); } - catch(const IceUtil::Exception& ex) - { - cerr << _appName << " (while destroying in response to signal " << signal - << "): " << ex << endl; - } catch(const std::exception& ex) { cerr << _appName << " (while destroying in response to signal " << signal @@ -181,11 +176,6 @@ shutdownOnInterruptCallback(int signal) { _communicator->shutdown(); } - catch(const IceUtil::Exception& ex) - { - cerr << _appName << " (while shutting down in response to signal " << signal - << "): " << ex << endl; - } catch(const std::exception& ex) { cerr << _appName << " (while shutting down in response to signal " << signal @@ -238,11 +228,6 @@ callbackOnInterruptCallback(int signal) { _application->interruptCallback(signal); } - catch(const IceUtil::Exception& ex) - { - cerr << _appName << " (while interrupting in response to signal " << signal - << "): " << ex << endl; - } catch(const std::exception& ex) { cerr << _appName << " (while interrupting in response to signal " << signal @@ -301,14 +286,9 @@ Ice::Application::main(int argc, char* argv[], const char* configFile) initData.properties = createProperties(); initData.properties->load(configFile); } - catch(const IceUtil::Exception& ex) - { - cerr << argv[0] << ": " << ex << endl; - return EXIT_FAILURE; - } catch(const std::exception& ex) { - cerr << argv[0] << ": std::exception: " << ex.what() << endl; + cerr << argv[0] << ": " << ex.what() << endl; return EXIT_FAILURE; } catch(...) @@ -365,14 +345,9 @@ Ice::Application::main(int argc, char* argv[], const InitializationData& initDat destroyOnInterrupt(); status = run(argc, argv); } - catch(const IceUtil::Exception& ex) - { - cerr << _appName << ": " << ex << endl; - status = EXIT_FAILURE; - } catch(const std::exception& ex) { - cerr << _appName << ": std::exception: " << ex.what() << endl; + cerr << _appName << ex.what() << endl; status = EXIT_FAILURE; } catch(const std::string& msg) @@ -426,14 +401,9 @@ Ice::Application::main(int argc, char* argv[], const InitializationData& initDat { _communicator->destroy(); } - catch(const IceUtil::Exception& ex) - { - cerr << _appName << ": " << ex << endl; - status = EXIT_FAILURE; - } catch(const std::exception& ex) { - cerr << _appName << ": std::exception: " << ex.what() << endl; + cerr << _appName << ex.what() << endl; status = EXIT_FAILURE; } catch(...) @@ -469,14 +439,9 @@ Ice::Application::main(int argc, char* argv[], const char* configFile, const Ice initData.properties = createProperties(); initData.properties->load(configFile); } - catch(const IceUtil::Exception& ex) - { - cerr << argv[0] << ": " << ex << endl; - return EXIT_FAILURE; - } catch(const std::exception& ex) { - cerr << argv[0] << ": std::exception: " << ex.what() << endl; + cerr << argv[0] << ex.what() << endl; return EXIT_FAILURE; } catch(...) diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index bad13e36714..af2b506193d 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -1191,15 +1191,10 @@ IceInternal::IncomingConnectionFactory::ThreadPerIncomingConnectionFactory::run( { _factory->run(); } - catch(const Exception& ex) - { - Error out(_factory->_instance->initializationData().logger); - out << "exception in thread per incoming connection factory:\n" << _factory->toString() << ex; - } catch(const std::exception& ex) { Error out(_factory->_instance->initializationData().logger); - out << "std::exception in thread per incoming connection factory:\n" << _factory->toString() << ex.what(); + out << "exception in thread per incoming connection factory:\n" << _factory->toString() << ex.what(); } catch(...) { diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 6cf36a3435a..69d8d52206b 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -2723,15 +2723,10 @@ Ice::ConnectionI::ThreadPerConnection::run() { _connection->run(); } - catch(const Exception& ex) - { - Error out(_connection->_logger); - out << "exception in thread per connection:\n" << _connection->toString() << ex; - } catch(const std::exception& ex) { Error out(_connection->_logger); - out << "std::exception in thread per connection:\n" << _connection->toString() << ex.what(); + out << "exception in thread per connection:\n" << _connection->toString() << ex.what(); } catch(...) { diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index d9df8439f36..f1ac54bd083 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -92,11 +92,11 @@ IceInternal::IncomingBase::__warning(const string& msg) const } void -IceInternal::IncomingBase::__handleException(const Ice::Exception& ex) +IceInternal::IncomingBase::__handleException(const std::exception& ex) { try { - ex.ice_throw(); + throw ex; } catch(RequestFailedException& ex) { @@ -290,30 +290,28 @@ IceInternal::IncomingBase::__handleException(const Ice::Exception& ex) _connection->sendNoResponse(); } } -} - -void -IceInternal::IncomingBase::__handleException(const std::exception& ex) -{ - if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) + catch(const std::exception& ex) { - __warning(string("std::exception: ") + ex.what()); - } + if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) + { + __warning(string("std::exception: ") + ex.what()); + } - if(_response) - { - _os.endWriteEncaps(); - _os.b.resize(headerSize + 4); // Reply status position. - _os.write(replyUnknownException); - ostringstream str; - str << "std::exception: " << ex.what(); - _os.write(str.str(), false); - _connection->sendResponse(&_os, _compress); + if(_response) + { + _os.endWriteEncaps(); + _os.b.resize(headerSize + 4); // Reply status position. + _os.write(replyUnknownException); + ostringstream str; + str << "std::exception: " << ex.what(); + _os.write(str.str(), false); + _connection->sendResponse(&_os, _compress); + } + else + { + _connection->sendNoResponse(); + } } - else - { - _connection->sendNoResponse(); - } } void @@ -533,12 +531,6 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager) _locator->finished(_current, _servant, _cookie); } } - catch(const Exception& ex) - { - _is.endReadEncaps(); - __handleException(ex); - return; - } catch(const std::exception& ex) { _is.endReadEncaps(); diff --git a/cpp/src/Ice/IncomingAsync.cpp b/cpp/src/Ice/IncomingAsync.cpp index 7a7bc182f05..0db1a4acaf6 100644 --- a/cpp/src/Ice/IncomingAsync.cpp +++ b/cpp/src/Ice/IncomingAsync.cpp @@ -96,24 +96,6 @@ IceInternal::IncomingAsync::__response(bool ok) } void -IceInternal::IncomingAsync::__exception(const Exception& exc) -{ - try - { - if(!__servantLocatorFinished()) - { - return; - } - - __handleException(exc); - } - catch(const LocalException& ex) - { - _connection->invokeException(ex, 1); // Fatal invocation exception - } -} - -void IceInternal::IncomingAsync::__exception(const std::exception& exc) { try @@ -160,11 +142,6 @@ IceInternal::IncomingAsync::__servantLocatorFinished() } return true; } - catch(const Exception& ex) - { - __handleException(ex); - return false; - } catch(const std::exception& ex) { __handleException(ex); @@ -311,15 +288,6 @@ IceAsync::Ice::AMD_Object_ice_invoke::ice_response(bool ok, const vector<Byte>& } void -IceAsync::Ice::AMD_Object_ice_invoke::ice_exception(const Exception& ex) -{ - if(__validateException(ex)) - { - __exception(ex); - } -} - -void IceAsync::Ice::AMD_Object_ice_invoke::ice_exception(const std::exception& ex) { if(__validateException(ex)) @@ -361,15 +329,6 @@ IceAsync::Ice::AMD_Array_Object_ice_invoke::ice_response(bool ok, const pair<con } void -IceAsync::Ice::AMD_Array_Object_ice_invoke::ice_exception(const Exception& ex) -{ - if(__validateException(ex)) - { - __exception(ex); - } -} - -void IceAsync::Ice::AMD_Array_Object_ice_invoke::ice_exception(const std::exception& ex) { if(__validateException(ex)) diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp index 3b8d2a64b07..9c7d05b87f4 100644 --- a/cpp/src/Ice/Object.cpp +++ b/cpp/src/Ice/Object.cpp @@ -396,10 +396,6 @@ Ice::BlobjectAsync::__dispatch(Incoming& in, const Current& current) { ice_invoke_async(cb, inParams, current); } - catch(const Exception& ex) - { - cb->ice_exception(ex); - } catch(const ::std::exception& ex) { cb->ice_exception(ex); @@ -423,10 +419,6 @@ Ice::BlobjectArrayAsync::__dispatch(Incoming& in, const Current& current) { ice_invoke_async(cb, inParams, current); } - catch(const Exception& ex) - { - cb->ice_exception(ex); - } catch(const ::std::exception& ex) { cb->ice_exception(ex); diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index 88f51469587..40cb5336c23 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -181,10 +181,6 @@ IceInternal::OutgoingAsync::__finished(BasicStream& is) { __response(replyStatus == replyOK); } - catch(const Exception& ex) - { - warning(ex); - } catch(const std::exception& ex) { warning(ex); @@ -235,10 +231,6 @@ IceInternal::OutgoingAsync::__finished(const LocalException& exc) { ice_exception(exc); } - catch(const Exception& ex) - { - warning(ex); - } catch(const std::exception& ex) { warning(ex); @@ -382,22 +374,7 @@ IceInternal::OutgoingAsync::__send() } void -IceInternal::OutgoingAsync::warning(const Exception& ex) const -{ - if(__os) // Don't print anything if cleanup() was already called. - { - ReferencePtr ref = _proxy->__reference(); - if(ref->getInstance()->initializationData().properties-> - getPropertyAsIntWithDefault("Ice.Warn.AMICallback", 1) > 0) - { - Warning out(ref->getInstance()->initializationData().logger); - out << "Ice::Exception raised by AMI callback:\n" << ex; - } - } -} - -void -IceInternal::OutgoingAsync::warning(const std::exception& ex) const +IceInternal::OutgoingAsync::warning(const std::exception& exc) const { if(__os) // Don't print anything if cleanup() was already called. { @@ -406,7 +383,15 @@ IceInternal::OutgoingAsync::warning(const std::exception& ex) const getPropertyAsIntWithDefault("Ice.Warn.AMICallback", 1) > 0) { Warning out(ref->getInstance()->initializationData().logger); - out << "std::exception raised by AMI callback:\n" << ex.what(); + const Exception* ex = dynamic_cast<const ObjectNotExistException*>(&exc); + if(ex) + { + out << "Ice::Exception raised by AMI callback:\n" << ex; + } + else + { + out << "std::exception raised by AMI callback:\n" << exc.what(); + } } } } diff --git a/cpp/src/Ice/Service.cpp b/cpp/src/Ice/Service.cpp index e3c8decc1d0..155b2c68625 100755 --- a/cpp/src/Ice/Service.cpp +++ b/cpp/src/Ice/Service.cpp @@ -775,16 +775,10 @@ Ice::Service::run(int& argc, char* argv[], const InitializationData& initData) } } } - catch(const IceUtil::Exception& ex) - { - ostringstream ostr; - ostr << "service caught unhandled Ice exception:\n" << ex; - error(ostr.str()); - } catch(const std::exception& ex) { ostringstream ostr; - ostr << "service caught unhandled std::exception:\n" << ex.what(); + ostr << "service caught unhandled exception:\n" << ex.what(); error(ostr.str()); } catch(const std::string& msg) diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index 59d479ce841..9d2cd3bff6a 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -1061,16 +1061,10 @@ IceInternal::ThreadPool::EventHandlerThread::run() { promote = _pool->run(); } - catch(const Exception& ex) - { - Error out(_pool->_instance->initializationData().logger); - out << "exception in `" << _pool->_prefix << "':\n" << ex; - promote = true; - } catch(const std::exception& ex) { Error out(_pool->_instance->initializationData().logger); - out << "std::exception in `" << _pool->_prefix << "':\n" << ex.what(); + out << "exception in `" << _pool->_prefix << "':\n" << ex.what(); promote = true; } catch(...) diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 539366963ed..b8ac394fba5 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -3659,10 +3659,6 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) C << sb; C << nl << name << "_async" << argsAMD << ';'; C << eb; - C << nl << "catch(const ::Ice::Exception& __ex)"; - C << sb; - C << nl << "__cb->ice_exception(__ex);"; - C << eb; C << nl << "catch(const ::std::exception& __ex)"; C << sb; C << nl << "__cb->ice_exception(__ex);"; @@ -4887,7 +4883,6 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) H.inc(); H << sp; H << nl << "virtual void ice_response" << spar << paramsAMD << epar << " = 0;"; - H << nl << "virtual void ice_exception(const ::Ice::Exception&) = 0;"; H << nl << "virtual void ice_exception(const ::std::exception&) = 0;"; H << nl << "virtual void ice_exception() = 0;"; H << eb << ';'; @@ -5046,7 +5041,6 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p) H << sp; H << nl << "virtual void ice_response(" << params << ");"; - H << nl << "virtual void ice_exception(const ::Ice::Exception&);"; H << nl << "virtual void ice_exception(const ::std::exception&);"; H << nl << "virtual void ice_exception();"; H << eb << ';'; @@ -5090,7 +5084,7 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p) C << eb; C << sp << nl << "void" << nl << "IceAsync" << classScopedAMD << '_' << name - << "::ice_exception(const ::Ice::Exception& ex)"; + << "::ice_exception(const ::std::exception& ex)"; C << sb; if(throws.empty()) { @@ -5103,7 +5097,7 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p) { C << nl << "try"; C << sb; - C << nl << "ex.ice_throw();"; + C << nl << "throw ex;"; C << eb; ExceptionList::const_iterator r; for(r = throws.begin(); r != throws.end(); ++r) @@ -5117,7 +5111,7 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p) C << eb; C << eb; } - C << nl << "catch(const ::Ice::Exception& __ex)"; + C << nl << "catch(const ::std::exception& __ex)"; C << sb; C << nl << "if(__validateException(__ex))"; C << sb; @@ -5128,15 +5122,6 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p) C << eb; C << sp << nl << "void" << nl << "IceAsync" << classScopedAMD << '_' << name - << "::ice_exception(const ::std::exception& ex)"; - C << sb; - C << nl << "if(__validateException(ex))"; - C << sb; - C << nl << "__exception(ex);"; - C << eb; - C << eb; - - C << sp << nl << "void" << nl << "IceAsync" << classScopedAMD << '_' << name << "::ice_exception()"; C << sb; C << nl << "if(__validateException())"; |