From 4ee763e975aac0786855b9d4fb089f2cc397dcac Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Mon, 28 Oct 2024 10:55:04 -0400 Subject: [PATCH 1/3] Fix throwing of NotExist exceptions --- cpp/src/Glacier2/ClientBlobject.cpp | 12 ++++------- cpp/src/Glacier2/RoutingTable.cpp | 2 +- cpp/src/Glacier2/SessionRouterI.cpp | 10 +++++----- cpp/src/Ice/LoggerAdminI.cpp | 2 +- cpp/src/Ice/Object.cpp | 4 ++-- cpp/src/IceGrid/AdminCallbackRouter.cpp | 4 ++-- cpp/src/IceGrid/AdminSessionI.cpp | 20 +++++++++---------- cpp/src/IceGrid/InternalRegistryI.cpp | 4 ++-- cpp/src/IceGrid/NodeAdminRouter.cpp | 4 ++-- cpp/src/IceGrid/NodeI.cpp | 4 ++-- cpp/src/IceGrid/NodeSessionI.cpp | 6 +++--- cpp/src/IceGrid/RegistryAdminRouter.cpp | 8 ++++---- cpp/src/IceGrid/ReplicaSessionI.cpp | 12 +++++------ cpp/src/IceGrid/ServerI.cpp | 2 +- cpp/src/IceGrid/SessionI.cpp | 2 +- cpp/src/IceLocatorDiscovery/PluginI.cpp | 8 ++++---- cpp/src/IceStorm/TopicI.cpp | 4 ++-- cpp/src/IceStorm/TransientTopicI.cpp | 4 ++-- cpp/src/slice2cpp/Gen.cpp | 8 ++++---- cpp/test/Glacier2/sessionControl/SessionI.cpp | 2 +- cpp/test/Ice/ami/AllTests.cpp | 2 +- cpp/test/Ice/defaultServant/TestI.cpp | 8 ++++---- cpp/test/Ice/metrics/TestAMDI.cpp | 2 +- cpp/test/Ice/metrics/TestI.cpp | 2 +- .../Ice/servantLocator/ServantLocatorI.cpp | 2 +- cpp/test/Ice/servantLocator/TestAMDI.cpp | 6 +++--- cpp/test/Ice/servantLocator/TestI.cpp | 2 +- .../com/zeroc/IceGridGUI/AdminRouter.java | 6 ++---- js/src/Ice/Operation.js | 2 +- python/modules/IcePy/Util.cpp | 12 +++++------ swift/test/Ice/defaultServant/AllTests.swift | 8 ++++---- swift/test/Ice/invoke/TestI.swift | 5 +---- .../Ice/servantLocator/ServantLocatorI.swift | 3 +-- swift/test/Ice/servantLocator/TestI.swift | 5 +---- 34 files changed, 87 insertions(+), 100 deletions(-) diff --git a/cpp/src/Glacier2/ClientBlobject.cpp b/cpp/src/Glacier2/ClientBlobject.cpp index 96d8a2c3c43..53bf3528872 100644 --- a/cpp/src/Glacier2/ClientBlobject.cpp +++ b/cpp/src/Glacier2/ClientBlobject.cpp @@ -77,13 +77,9 @@ Glacier2::ClientBlobject::ice_invokeAsync( auto proxy = _routingTable->get(current.id); if (!proxy) { - // - // We use a special operation name indicate to the client that - // the proxy for the Ice object has not been found in our - // routing table. This can happen if the proxy was evicted - // from the routing table. - // - throw ObjectNotExistException(__FILE__, __LINE__, current.id, current.facet, "ice_add_proxy"); + // We use a special operation name indicate to the client that the proxy for the Ice object has not been found + // in our routing table. This can happen if the proxy was evicted from the routing table. + throw ObjectNotExistException{__FILE__, __LINE__, current.id, current.facet, "ice_add_proxy"}; } string adapterId = proxy->ice_getAdapterId(); @@ -114,7 +110,7 @@ Glacier2::ClientBlobject::ice_invokeAsync( out << "identity: " << _instance->communicator()->identityToString(current.id); } - throw ObjectNotExistException(__FILE__, __LINE__, current.id, "", ""); + throw ObjectNotExistException{__FILE__, __LINE__}; } invoke(proxy.value(), inParams, std::move(response), std::move(error), current); diff --git a/cpp/src/Glacier2/RoutingTable.cpp b/cpp/src/Glacier2/RoutingTable.cpp index 5876044f27b..e4af6509359 100644 --- a/cpp/src/Glacier2/RoutingTable.cpp +++ b/cpp/src/Glacier2/RoutingTable.cpp @@ -62,7 +62,7 @@ Glacier2::RoutingTable::add(const ObjectProxySeq& unfiltered, const Current& cur if (!_verifier->verify(*prx)) { current.con->abort(); - throw ObjectNotExistException(__FILE__, __LINE__); + throw ObjectNotExistException{__FILE__, __LINE__}; } ObjectPrx proxy = prx->ice_twoway()->ice_secure(false)->ice_facet(""); // We add proxies in default form. diff --git a/cpp/src/Glacier2/SessionRouterI.cpp b/cpp/src/Glacier2/SessionRouterI.cpp index 8d789a5dafa..fb30fe50585 100644 --- a/cpp/src/Glacier2/SessionRouterI.cpp +++ b/cpp/src/Glacier2/SessionRouterI.cpp @@ -695,7 +695,7 @@ SessionRouterI::destroySession(const ConnectionPtr& connection) if (_destroy) { - throw ObjectNotExistException(__FILE__, __LINE__); + throw ObjectNotExistException{__FILE__, __LINE__}; } map>::const_iterator p; @@ -788,7 +788,7 @@ SessionRouterI::getServerBlobject(const string& category) const if (_destroy) { - throw ObjectNotExistException(__FILE__, __LINE__); + throw ObjectNotExistException{__FILE__, __LINE__}; } if (_routersByCategoryHint != _routersByCategory.cend() && _routersByCategoryHint->first == category) @@ -805,7 +805,7 @@ SessionRouterI::getServerBlobject(const string& category) const } else { - throw ObjectNotExistException(__FILE__, __LINE__); + throw ObjectNotExistException{__FILE__, __LINE__}; } } @@ -819,7 +819,7 @@ SessionRouterI::getRouterImpl(const ConnectionPtr& connection, const Ice::Identi // if (_destroy || !connection) { - throw ObjectNotExistException(__FILE__, __LINE__); + throw ObjectNotExistException{__FILE__, __LINE__}; } if (_routersByConnectionHint != _routersByConnection.cend() && _routersByConnectionHint->first == connection) @@ -843,7 +843,7 @@ SessionRouterI::getRouterImpl(const ConnectionPtr& connection, const Ice::Identi out << "identity: " << identityToString(id); } connection->abort(); - throw ObjectNotExistException(__FILE__, __LINE__); + throw ObjectNotExistException{__FILE__, __LINE__}; } return nullptr; } diff --git a/cpp/src/Ice/LoggerAdminI.cpp b/cpp/src/Ice/LoggerAdminI.cpp index 2a4b9b4808f..787ee06073d 100644 --- a/cpp/src/Ice/LoggerAdminI.cpp +++ b/cpp/src/Ice/LoggerAdminI.cpp @@ -295,7 +295,7 @@ namespace { if (_destroyed) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } _sendLogCommunicator = diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp index b3088524681..a2062e0a87d 100644 --- a/cpp/src/Ice/Object.cpp +++ b/cpp/src/Ice/Object.cpp @@ -110,7 +110,7 @@ Ice::Object::dispatch(IncomingRequest& request, std::functionsecond; } @@ -63,7 +63,7 @@ AdminCallbackRouter::ice_invokeAsync( inParams, std::move(response), [exception = std::move(exception)](exception_ptr) - { exception(make_exception_ptr(Ice::ObjectNotExistException(__FILE__, __LINE__))); }, + { exception(make_exception_ptr(Ice::ObjectNotExistException{__FILE__, __LINE__})); }, nullptr, current.ctx); } diff --git a/cpp/src/IceGrid/AdminSessionI.cpp b/cpp/src/IceGrid/AdminSessionI.cpp index aa0ef6c578e..7314edf5800 100644 --- a/cpp/src/IceGrid/AdminSessionI.cpp +++ b/cpp/src/IceGrid/AdminSessionI.cpp @@ -34,7 +34,7 @@ namespace [exception = std::move(exception)](exception_ptr) { // Throw ObjectNotExistException, the subscriber is unreachable - exception(make_exception_ptr(Ice::ObjectNotExistException(__FILE__, __LINE__))); + exception(make_exception_ptr(Ice::ObjectNotExistException{__FILE__, __LINE__})); }, nullptr, current.ctx); @@ -138,13 +138,13 @@ AdminSessionI::setObservers( optional appObserver, optional adapterObserver, optional objectObserver, - const Ice::Current& current) + const Ice::Current&) { lock_guard lock(_mutex); if (_destroyed) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__, current.id, "", ""); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } const auto locator = _registry->getLocator(); @@ -207,7 +207,7 @@ AdminSessionI::setObserversByIdentity( if (_destroyed) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__, current.id, "", ""); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } setupObserverSubscription(TopicName::RegistryObserver, addForwarder(registryObserver, current), true); @@ -218,13 +218,13 @@ AdminSessionI::setObserversByIdentity( } int -AdminSessionI::startUpdate(const Ice::Current& current) +AdminSessionI::startUpdate(const Ice::Current&) { lock_guard lock(_mutex); if (_destroyed) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__, current.id, "", ""); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } int serial = _database->lock(this, _id); @@ -232,13 +232,13 @@ AdminSessionI::startUpdate(const Ice::Current& current) } void -AdminSessionI::finishUpdate(const Ice::Current& current) +AdminSessionI::finishUpdate(const Ice::Current&) { lock_guard lock(_mutex); if (_destroyed) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__, current.id, "", ""); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } _database->unlock(this); @@ -375,13 +375,13 @@ AdminSessionI::addForwarder(Ice::ObjectPrx prx) } FileIteratorPrx -AdminSessionI::addFileIterator(FileReaderPrx reader, const string& filename, int nLines, const Ice::Current& current) +AdminSessionI::addFileIterator(FileReaderPrx reader, const string& filename, int nLines, const Ice::Current&) { lock_guard lock(_mutex); if (_destroyed) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__, current.id, "", ""); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } // Always call getOffsetFromEnd even if nLines < 0. This allows to throw right away if the file doesn't exit. diff --git a/cpp/src/IceGrid/InternalRegistryI.cpp b/cpp/src/IceGrid/InternalRegistryI.cpp index 5dbe7c17a72..9f84c459991 100644 --- a/cpp/src/IceGrid/InternalRegistryI.cpp +++ b/cpp/src/IceGrid/InternalRegistryI.cpp @@ -67,7 +67,7 @@ InternalRegistryI::registerNode( } catch (const Ice::ObjectAdapterDestroyedException&) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } } @@ -98,7 +98,7 @@ InternalRegistryI::registerReplica( } catch (const Ice::ObjectAdapterDestroyedException&) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } } diff --git a/cpp/src/IceGrid/NodeAdminRouter.cpp b/cpp/src/IceGrid/NodeAdminRouter.cpp index afe2b1359d4..ee38a4a228c 100644 --- a/cpp/src/IceGrid/NodeAdminRouter.cpp +++ b/cpp/src/IceGrid/NodeAdminRouter.cpp @@ -37,7 +37,7 @@ NodeServerAdminRouter::ice_invokeAsync( out << "could not find Admin proxy for server `" << current.id.name << "'"; } - throw ObjectNotExistException(__FILE__, __LINE__); + throw ObjectNotExistException{__FILE__, __LINE__}; } // @@ -53,7 +53,7 @@ NodeServerAdminRouter::ice_invokeAsync( out << "no Process proxy registered with server `" << current.id.name << "'"; } - throw ObjectNotExistException(__FILE__, __LINE__); + throw ObjectNotExistException{__FILE__, __LINE__}; } // diff --git a/cpp/src/IceGrid/NodeI.cpp b/cpp/src/IceGrid/NodeI.cpp index 96c24d36ad3..800c2609703 100644 --- a/cpp/src/IceGrid/NodeI.cpp +++ b/cpp/src/IceGrid/NodeI.cpp @@ -843,7 +843,7 @@ NodeI::loadServer( // We throw an object not exist exception to avoid dispatch warnings. The registry will consider the // node has being unreachable upon receipt of this exception (like any other Ice::LocalException). We // could also have disabled dispatch warnings but they can still useful to catch other issues. - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } try @@ -906,7 +906,7 @@ NodeI::destroyServer( // We throw an object not exist exception to avoid dispatch warnings. The registry will consider the node // has being unreachable upon receipt of this exception (like any other Ice::LocalException). We could also // have disabled dispatch warnings but they can still useful to catch other issues. - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } if (!server) diff --git a/cpp/src/IceGrid/NodeSessionI.cpp b/cpp/src/IceGrid/NodeSessionI.cpp index 2ef0ecb8138..16e2f0da3af 100644 --- a/cpp/src/IceGrid/NodeSessionI.cpp +++ b/cpp/src/IceGrid/NodeSessionI.cpp @@ -84,7 +84,7 @@ NodeSessionI::keepAlive(LoadInfo load, const Ice::Current&) if (_destroy) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } _timestamp = chrono::steady_clock::now(); @@ -192,7 +192,7 @@ NodeSessionI::timestamp() const lock_guard lock(_mutex); if (_destroy) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } return _timestamp; } @@ -242,7 +242,7 @@ NodeSessionI::destroyImpl(bool shutdown) lock_guard lock(_mutex); if (_destroy) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } _destroy = true; } diff --git a/cpp/src/IceGrid/RegistryAdminRouter.cpp b/cpp/src/IceGrid/RegistryAdminRouter.cpp index bb311f8c338..cc413c4f2b9 100644 --- a/cpp/src/IceGrid/RegistryAdminRouter.cpp +++ b/cpp/src/IceGrid/RegistryAdminRouter.cpp @@ -44,7 +44,7 @@ namespace void synchronized(exception_ptr) { - _exception(make_exception_ptr(Ice::ObjectNotExistException(__FILE__, __LINE__))); + _exception(make_exception_ptr(Ice::ObjectNotExistException{__FILE__, __LINE__})); } private: @@ -101,7 +101,7 @@ RegistryServerAdminRouter::ice_invokeAsync( if (target == nullopt) { - throw ObjectNotExistException(__FILE__, __LINE__); + throw ObjectNotExistException{__FILE__, __LINE__}; } invokeOnTarget(target->ice_facet(current.facet), inParams, std::move(response), std::move(exception), current); } @@ -148,7 +148,7 @@ RegistryNodeAdminRouter::ice_invokeAsync( out << "could not find Admin proxy for node `" << current.id.name << "'"; } - throw ObjectNotExistException(__FILE__, __LINE__); + throw ObjectNotExistException{__FILE__, __LINE__}; } } @@ -196,7 +196,7 @@ RegistryReplicaAdminRouter::ice_invokeAsync( out << "could not find Admin proxy for replica `" << current.id.name << "'"; } - throw ObjectNotExistException(__FILE__, __LINE__); + throw ObjectNotExistException{__FILE__, __LINE__}; } invokeOnTarget(target->ice_facet(current.facet), inParams, std::move(response), std::move(exception), current); } diff --git a/cpp/src/IceGrid/ReplicaSessionI.cpp b/cpp/src/IceGrid/ReplicaSessionI.cpp index dade6e9f895..05da3947105 100644 --- a/cpp/src/IceGrid/ReplicaSessionI.cpp +++ b/cpp/src/IceGrid/ReplicaSessionI.cpp @@ -88,7 +88,7 @@ ReplicaSessionI::keepAlive(const Ice::Current&) lock_guard lock(_mutex); if (_destroy) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } _timestamp = chrono::steady_clock::now(); @@ -168,7 +168,7 @@ ReplicaSessionI::setDatabaseObserver( lock_guard lock(_mutex); if (_destroy) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } _observer = observer; @@ -189,7 +189,7 @@ ReplicaSessionI::setEndpoints(StringObjectProxyDict endpoints, const Ice::Curren lock_guard lock(_mutex); if (_destroy) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } _replicaEndpoints = std::move(endpoints); } @@ -204,7 +204,7 @@ ReplicaSessionI::registerWellKnownObjects(ObjectInfoSeq objects, const Ice::Curr lock_guard lock(_mutex); if (_destroy) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } _replicaWellKnownObjects = objects; serial = _database->addOrUpdateRegistryWellKnownObjects(objects); @@ -255,7 +255,7 @@ ReplicaSessionI::timestamp() const lock_guard lock(_mutex); if (_destroy) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } return _timestamp; } @@ -309,7 +309,7 @@ ReplicaSessionI::destroyImpl(bool shutdown) lock_guard lock(_mutex); if (_destroy) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } _destroy = true; } diff --git a/cpp/src/IceGrid/ServerI.cpp b/cpp/src/IceGrid/ServerI.cpp index 9a7821c22aa..3d146c4b50f 100644 --- a/cpp/src/IceGrid/ServerI.cpp +++ b/cpp/src/IceGrid/ServerI.cpp @@ -1360,7 +1360,7 @@ ServerI::checkDestroyed() const if (_state == Destroyed) { assert(_this); - throw Ice::ObjectNotExistException(__FILE__, __LINE__, _this->ice_getIdentity(), "", ""); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } } diff --git a/cpp/src/IceGrid/SessionI.cpp b/cpp/src/IceGrid/SessionI.cpp index 7e6084dc66a..a9e7798e9bc 100644 --- a/cpp/src/IceGrid/SessionI.cpp +++ b/cpp/src/IceGrid/SessionI.cpp @@ -68,7 +68,7 @@ BaseSessionI::destroyImpl(bool) lock_guard lock(_mutex); if (_destroyed) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } _destroyed = true; diff --git a/cpp/src/IceLocatorDiscovery/PluginI.cpp b/cpp/src/IceLocatorDiscovery/PluginI.cpp index 7ba9c67d0bd..f00b812e056 100644 --- a/cpp/src/IceLocatorDiscovery/PluginI.cpp +++ b/cpp/src/IceLocatorDiscovery/PluginI.cpp @@ -356,19 +356,19 @@ Request::exception(std::exception_ptr ex) } catch (const Ice::NoEndpointException&) { - _exceptionCallback(make_exception_ptr(Ice::ObjectNotExistException(__FILE__, __LINE__))); + _exceptionCallback(make_exception_ptr(Ice::ObjectNotExistException{__FILE__, __LINE__})); } catch (const Ice::CommunicatorDestroyedException&) { - _exceptionCallback(make_exception_ptr(Ice::ObjectNotExistException(__FILE__, __LINE__))); + _exceptionCallback(make_exception_ptr(Ice::ObjectNotExistException{__FILE__, __LINE__})); } catch (const Ice::ObjectAdapterDeactivatedException&) { - _exceptionCallback(make_exception_ptr(Ice::ObjectNotExistException(__FILE__, __LINE__))); + _exceptionCallback(make_exception_ptr(Ice::ObjectNotExistException{__FILE__, __LINE__})); } catch (const Ice::ObjectAdapterDestroyedException&) { - _exceptionCallback(make_exception_ptr(Ice::ObjectNotExistException(__FILE__, __LINE__))); + _exceptionCallback(make_exception_ptr(Ice::ObjectNotExistException{__FILE__, __LINE__})); } catch (...) { diff --git a/cpp/src/IceStorm/TopicI.cpp b/cpp/src/IceStorm/TopicI.cpp index 09c6447fd0e..b6a3d314828 100644 --- a/cpp/src/IceStorm/TopicI.cpp +++ b/cpp/src/IceStorm/TopicI.cpp @@ -664,7 +664,7 @@ TopicImpl::unlink(const TopicPrx& topic) if (_destroyed) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } Ice::Identity id = topic->ice_getIdentity(); @@ -775,7 +775,7 @@ TopicImpl::destroy() if (_destroyed) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } _destroyed = true; diff --git a/cpp/src/IceStorm/TransientTopicI.cpp b/cpp/src/IceStorm/TransientTopicI.cpp index 7976950e38f..38c8bdc096d 100644 --- a/cpp/src/IceStorm/TransientTopicI.cpp +++ b/cpp/src/IceStorm/TransientTopicI.cpp @@ -259,7 +259,7 @@ TransientTopicImpl::unlink(optional topic, const Ice::Current&) if (_destroyed) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } auto id = topic->ice_getIdentity(); @@ -335,7 +335,7 @@ TransientTopicImpl::destroy(const Ice::Current&) if (_destroyed) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } _destroyed = true; diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index babec80b6f6..66f1d3811df 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -2888,8 +2888,8 @@ Slice::Gen::InterfaceVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) C << nl << "if(r.first == r.second)"; C << sb; C << nl - << "sendResponse(::Ice::makeOutgoingResponse(::std::make_exception_ptr(::Ice::OperationNotExistException(__" - "FILE__, __LINE__)), current));"; + << "sendResponse(::Ice::makeOutgoingResponse(::std::make_exception_ptr(::Ice::OperationNotExistException{__" + "FILE__, __LINE__}), current));"; C << nl << "return;"; C << eb; C << sp; @@ -2908,8 +2908,8 @@ Slice::Gen::InterfaceVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) C << sb; C << nl << "assert(false);"; C << nl - << "sendResponse(::Ice::makeOutgoingResponse(::std::make_exception_ptr(::Ice::OperationNotExistException(__" - "FILE__, __LINE__)), current));"; + << "sendResponse(::Ice::makeOutgoingResponse(::std::make_exception_ptr(::Ice::OperationNotExistException{__" + "FILE__, __LINE__}), current));"; C << eb; C << eb; C << eb; diff --git a/cpp/test/Glacier2/sessionControl/SessionI.cpp b/cpp/test/Glacier2/sessionControl/SessionI.cpp index f3a28e604f2..2bfd0b8f40c 100644 --- a/cpp/test/Glacier2/sessionControl/SessionI.cpp +++ b/cpp/test/Glacier2/sessionControl/SessionI.cpp @@ -21,7 +21,7 @@ SessionManagerI::create( } if (userId == "localexception") { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } return current.adapter->addWithUUID(make_shared(sessionControl)); } diff --git a/cpp/test/Ice/ami/AllTests.cpp b/cpp/test/Ice/ami/AllTests.cpp index 33f1108317e..3db828b8335 100644 --- a/cpp/test/Ice/ami/AllTests.cpp +++ b/cpp/test/Ice/ami/AllTests.cpp @@ -47,7 +47,7 @@ namespace { case ThrowType::LocalException: { - throw ObjectNotExistException(__FILE__, __LINE__); + throw ObjectNotExistException{__FILE__, __LINE__}; break; } case ThrowType::UserException: diff --git a/cpp/test/Ice/defaultServant/TestI.cpp b/cpp/test/Ice/defaultServant/TestI.cpp index 7df34a6b76c..5fd5955141f 100644 --- a/cpp/test/Ice/defaultServant/TestI.cpp +++ b/cpp/test/Ice/defaultServant/TestI.cpp @@ -14,11 +14,11 @@ MyObjectI::ice_ping(const Ice::Current& current) const if (name == "ObjectNotExist") { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } else if (name == "FacetNotExist") { - throw Ice::FacetNotExistException(__FILE__, __LINE__); + throw Ice::FacetNotExistException{__FILE__, __LINE__}; } } @@ -29,11 +29,11 @@ MyObjectI::getName(const Ice::Current& current) if (name == "ObjectNotExist") { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } else if (name == "FacetNotExist") { - throw Ice::FacetNotExistException(__FILE__, __LINE__); + throw Ice::FacetNotExistException{__FILE__, __LINE__}; } return name; diff --git a/cpp/test/Ice/metrics/TestAMDI.cpp b/cpp/test/Ice/metrics/TestAMDI.cpp index 760e14128ec..34e1d008dd7 100644 --- a/cpp/test/Ice/metrics/TestAMDI.cpp +++ b/cpp/test/Ice/metrics/TestAMDI.cpp @@ -38,7 +38,7 @@ MetricsI::opWithRequestFailedExceptionAsync(function, function response, function, const Current&) { response(); - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } void @@ -146,7 +146,7 @@ TestAMDI::asyncExceptionAsync(function, function er { error(current_exception()); } - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } void diff --git a/cpp/test/Ice/servantLocator/TestI.cpp b/cpp/test/Ice/servantLocator/TestI.cpp index 644749f3159..6223e186a8b 100644 --- a/cpp/test/Ice/servantLocator/TestI.cpp +++ b/cpp/test/Ice/servantLocator/TestI.cpp @@ -51,7 +51,7 @@ TestI::cppException(const Current&) void TestI::unknownExceptionWithServantException(const Current&) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException{__FILE__, __LINE__}; } string diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdminRouter.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdminRouter.java index 0a830d0657a..066140f88fc 100644 --- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdminRouter.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdminRouter.java @@ -9,8 +9,7 @@ class AdminRouter implements com.zeroc.Ice.Blobject { public com.zeroc.Ice.Object.Ice_invokeResult ice_invoke( byte[] inParams, com.zeroc.Ice.Current current) { if (_admin == null) { - throw new com.zeroc.Ice.ObjectNotExistException( - current.id, current.facet, current.operation); + throw new com.zeroc.Ice.ObjectNotExistException(); } else if (current.operation.equals("ice_id") || current.operation.equals("ice_ids") || current.operation.equals("ice_isA") @@ -19,8 +18,7 @@ public com.zeroc.Ice.Object.Ice_invokeResult ice_invoke( return _admin.ice_invoke(current.operation, current.mode, inParams, current.ctx); } else { // Routing other operations could be a security risk - throw new com.zeroc.Ice.OperationNotExistException( - current.id, current.facet, current.operation); + throw new com.zeroc.Ice.OperationNotExistException(); } } diff --git a/js/src/Ice/Operation.js b/js/src/Ice/Operation.js index 88d109616fb..abae7082085 100644 --- a/js/src/Ice/Operation.js +++ b/js/src/Ice/Operation.js @@ -498,7 +498,7 @@ export function defineOperations(classType, proxyType, ids, id, ops) { const method = getServantMethod(classType, request.current.operation); if (method === undefined || typeof method !== "function") { - throw new OperationNotExistException(request.current.id, request.current.facet, request.current.operation); + throw new OperationNotExistException(); } return method.call(method, this, request); diff --git a/python/modules/IcePy/Util.cpp b/python/modules/IcePy/Util.cpp index 8e6c7c16499..ecfdcf018c5 100644 --- a/python/modules/IcePy/Util.cpp +++ b/python/modules/IcePy/Util.cpp @@ -334,30 +334,30 @@ IcePy::PyException::raise() if (typeName == "Ice.ObjectNotExistException") { - throw Ice::ObjectNotExistException( + throw Ice::ObjectNotExistException{ __FILE__, __LINE__, std::move(id), std::move(facet), - std::move(operation)); + std::move(operation)}; } else if (typeName == "Ice.OperationNotExistException") { - throw Ice::OperationNotExistException( + throw Ice::OperationNotExistException{ __FILE__, __LINE__, std::move(id), std::move(facet), - std::move(operation)); + std::move(operation)}; } else if (typeName == "Ice.FacetNotExistException") { - throw Ice::FacetNotExistException( + throw Ice::FacetNotExistException{ __FILE__, __LINE__, std::move(id), std::move(facet), - std::move(operation)); + std::move(operation)}; } } diff --git a/swift/test/Ice/defaultServant/AllTests.swift b/swift/test/Ice/defaultServant/AllTests.swift index 9fc1eed59a4..18ea3e36173 100644 --- a/swift/test/Ice/defaultServant/AllTests.swift +++ b/swift/test/Ice/defaultServant/AllTests.swift @@ -6,17 +6,17 @@ import TestCommon final class MyObjectI: ObjectI, MyObject { override func ice_ping(current: Ice.Current) async throws { if current.id.name == "ObjectNotExist" { - throw Ice.ObjectNotExistException(id: current.id, facet: "", operation: "ice_ping") + throw Ice.ObjectNotExistException() } else if current.id.name == "FacetNotExist" { - throw Ice.FacetNotExistException(id: current.id, facet: "", operation: "ice_ping") + throw Ice.FacetNotExistException() } } func getName(current: Ice.Current) async throws -> String { if current.id.name == "ObjectNotExist" { - throw Ice.ObjectNotExistException(id: current.id, facet: "", operation: "ice_ping") + throw Ice.ObjectNotExistException() } else if current.id.name == "FacetNotExist" { - throw Ice.FacetNotExistException(id: current.id, facet: "", operation: "ice_ping") + throw Ice.FacetNotExistException() } return current.id.name } diff --git a/swift/test/Ice/invoke/TestI.swift b/swift/test/Ice/invoke/TestI.swift index 2bcd3650ccc..f1a23b1f33a 100644 --- a/swift/test/Ice/invoke/TestI.swift +++ b/swift/test/Ice/invoke/TestI.swift @@ -55,10 +55,7 @@ class DispatcherI: Ice.Dispatcher { } } } else { - throw Ice.OperationNotExistException( - id: current.id, - facet: current.facet, - operation: current.operation) + throw Ice.OperationNotExistException() } } } diff --git a/swift/test/Ice/servantLocator/ServantLocatorI.swift b/swift/test/Ice/servantLocator/ServantLocatorI.swift index 4d3ec06cff4..9f3885bf997 100644 --- a/swift/test/Ice/servantLocator/ServantLocatorI.swift +++ b/swift/test/Ice/servantLocator/ServantLocatorI.swift @@ -92,8 +92,7 @@ class ServantLocatorI: Ice.ServantLocator { if current.operation == "ice_ids" { throw TestIntfUserException() } else if current.operation == "requestFailedException" { - throw Ice.ObjectNotExistException( - id: current.id, facet: current.facet, operation: current.operation) + throw Ice.ObjectNotExistException() } else if current.operation == "unknownUserException" { throw Ice.UnknownUserException(badTypeId: "::Foo::BarException") } else if current.operation == "unknownLocalException" { diff --git a/swift/test/Ice/servantLocator/TestI.swift b/swift/test/Ice/servantLocator/TestI.swift index 5d71ef18c19..a319c292378 100644 --- a/swift/test/Ice/servantLocator/TestI.swift +++ b/swift/test/Ice/servantLocator/TestI.swift @@ -18,10 +18,7 @@ class TestI: TestIntf { func userException(current _: Current) async throws {} func unknownExceptionWithServantException(current: Current) async throws { - throw ObjectNotExistException( - id: current.id, - facet: current.facet, - operation: current.operation) + throw ObjectNotExistException() } func impossibleException(throw t: Bool, current _: Current) async throws -> String { From 9fa5fc3d63596df58d7053f5a36e14f61555cfd5 Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Mon, 28 Oct 2024 11:05:22 -0400 Subject: [PATCH 2/3] Update cpp/src/Glacier2/ClientBlobject.cpp Co-authored-by: Jose --- cpp/src/Glacier2/ClientBlobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/Glacier2/ClientBlobject.cpp b/cpp/src/Glacier2/ClientBlobject.cpp index 53bf3528872..8949f1a41c1 100644 --- a/cpp/src/Glacier2/ClientBlobject.cpp +++ b/cpp/src/Glacier2/ClientBlobject.cpp @@ -77,7 +77,7 @@ Glacier2::ClientBlobject::ice_invokeAsync( auto proxy = _routingTable->get(current.id); if (!proxy) { - // We use a special operation name indicate to the client that the proxy for the Ice object has not been found + // We use a special operation name to indicate to the client that the proxy for the Ice object has not been found // in our routing table. This can happen if the proxy was evicted from the routing table. throw ObjectNotExistException{__FILE__, __LINE__, current.id, current.facet, "ice_add_proxy"}; } From 22b0172dbb9062c19929ef71923a76fa7d29d9f6 Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Mon, 28 Oct 2024 11:33:53 -0400 Subject: [PATCH 3/3] Reformat --- cpp/src/Glacier2/ClientBlobject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/src/Glacier2/ClientBlobject.cpp b/cpp/src/Glacier2/ClientBlobject.cpp index 8949f1a41c1..39130ea3765 100644 --- a/cpp/src/Glacier2/ClientBlobject.cpp +++ b/cpp/src/Glacier2/ClientBlobject.cpp @@ -77,8 +77,8 @@ Glacier2::ClientBlobject::ice_invokeAsync( auto proxy = _routingTable->get(current.id); if (!proxy) { - // We use a special operation name to indicate to the client that the proxy for the Ice object has not been found - // in our routing table. This can happen if the proxy was evicted from the routing table. + // We use a special operation name to indicate to the client that the proxy for the Ice object has not been + // found in our routing table. This can happen if the proxy was evicted from the routing table. throw ObjectNotExistException{__FILE__, __LINE__, current.id, current.facet, "ice_add_proxy"}; }