Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix throwing of NotExist exceptions #2984

Merged
merged 3 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions cpp/src/Glacier2/ClientBlobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 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"};
}

string adapterId = proxy->ice_getAdapterId();
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/Glacier2/RoutingTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions cpp/src/Glacier2/SessionRouterI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ SessionRouterI::destroySession(const ConnectionPtr& connection)

if (_destroy)
{
throw ObjectNotExistException(__FILE__, __LINE__);
throw ObjectNotExistException{__FILE__, __LINE__};
}

map<ConnectionPtr, shared_ptr<RouterI>>::const_iterator p;
Expand Down Expand Up @@ -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)
Expand All @@ -805,7 +805,7 @@ SessionRouterI::getServerBlobject(const string& category) const
}
else
{
throw ObjectNotExistException(__FILE__, __LINE__);
throw ObjectNotExistException{__FILE__, __LINE__};
}
}

Expand All @@ -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)
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/Ice/LoggerAdminI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ namespace
{
if (_destroyed)
{
throw Ice::ObjectNotExistException(__FILE__, __LINE__);
throw Ice::ObjectNotExistException{__FILE__, __LINE__};
}

_sendLogCommunicator =
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/Ice/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Ice::Object::dispatch(IncomingRequest& request, std::function<void(OutgoingRespo

if (r.first == r.second)
{
sendResponse(makeOutgoingResponse(make_exception_ptr(OperationNotExistException(__FILE__, __LINE__)), current));
sendResponse(makeOutgoingResponse(make_exception_ptr(OperationNotExistException{__FILE__, __LINE__}), current));
return;
}

Expand Down Expand Up @@ -140,7 +140,7 @@ Ice::Object::dispatch(IncomingRequest& request, std::function<void(OutgoingRespo
{
assert(false);
sendResponse(
makeOutgoingResponse(make_exception_ptr(OperationNotExistException(__FILE__, __LINE__)), current));
makeOutgoingResponse(make_exception_ptr(OperationNotExistException{__FILE__, __LINE__}), current));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/IceGrid/AdminCallbackRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ AdminCallbackRouter::ice_invokeAsync(
auto p = _categoryToConnection.find(current.id.category);
if (p == _categoryToConnection.end())
{
throw Ice::ObjectNotExistException(__FILE__, __LINE__);
throw Ice::ObjectNotExistException{__FILE__, __LINE__};
}
con = p->second;
}
Expand All @@ -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);
}
20 changes: 10 additions & 10 deletions cpp/src/IceGrid/AdminSessionI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -138,13 +138,13 @@ AdminSessionI::setObservers(
optional<ApplicationObserverPrx> appObserver,
optional<AdapterObserverPrx> adapterObserver,
optional<ObjectObserverPrx> 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();
Expand Down Expand Up @@ -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);
Expand All @@ -218,27 +218,27 @@ 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);
return serial;
}

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);
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/IceGrid/InternalRegistryI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ InternalRegistryI::registerNode(
}
catch (const Ice::ObjectAdapterDestroyedException&)
{
throw Ice::ObjectNotExistException(__FILE__, __LINE__);
throw Ice::ObjectNotExistException{__FILE__, __LINE__};
}
}

Expand Down Expand Up @@ -98,7 +98,7 @@ InternalRegistryI::registerReplica(
}
catch (const Ice::ObjectAdapterDestroyedException&)
{
throw Ice::ObjectNotExistException(__FILE__, __LINE__);
throw Ice::ObjectNotExistException{__FILE__, __LINE__};
}
}

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/IceGrid/NodeAdminRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__};
}

//
Expand All @@ -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__};
}

//
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/IceGrid/NodeI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/IceGrid/NodeSessionI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/IceGrid/RegistryAdminRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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__};
}
}

Expand Down Expand Up @@ -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);
}
12 changes: 6 additions & 6 deletions cpp/src/IceGrid/ReplicaSessionI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -168,7 +168,7 @@ ReplicaSessionI::setDatabaseObserver(
lock_guard lock(_mutex);
if (_destroy)
{
throw Ice::ObjectNotExistException(__FILE__, __LINE__);
throw Ice::ObjectNotExistException{__FILE__, __LINE__};
}
_observer = observer;

Expand All @@ -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);
}
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/IceGrid/ServerI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__};
}
}

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/IceGrid/SessionI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading
Loading