diff --git a/cpp/include/Ice/ProxyFunctions.h b/cpp/include/Ice/ProxyFunctions.h index 459442f79b0..b3f69dbb7e5 100644 --- a/cpp/include/Ice/ProxyFunctions.h +++ b/cpp/include/Ice/ProxyFunctions.h @@ -15,11 +15,13 @@ namespace Ice /** * Verifies that a proxy received from the client is not null, and throws a MarshalException if it is. * @param prx The proxy to check. + * @param file The source file name. + * @param line The source line number. * @param current The Current object for the invocation. * @throw MarshalException If the proxy is null. * */ template::value, bool> = true> - void checkNotNull(std::optional prx, const Current& current) + void checkNotNull(std::optional prx, const char* file, int line, const Current& current) { if (!prx) { @@ -27,7 +29,7 @@ namespace Ice std::ostringstream os; os << "null proxy passed to " << current.operation << " on object " << current.adapter->getCommunicator()->identityToString(current.id); - throw MarshalException{__FILE__, __LINE__, os.str()}; + throw MarshalException{file, line, os.str()}; } } diff --git a/cpp/src/IceDiscovery/LookupI.cpp b/cpp/src/IceDiscovery/LookupI.cpp index 68f91e26dc9..b490f882a81 100644 --- a/cpp/src/IceDiscovery/LookupI.cpp +++ b/cpp/src/IceDiscovery/LookupI.cpp @@ -480,13 +480,13 @@ LookupReplyI::LookupReplyI(const LookupIPtr& lookup) : _lookup(lookup) {} void LookupReplyI::foundObjectById(Identity id, optional proxy, const Current& current) { - Ice::checkNotNull(proxy, current); + checkNotNull(proxy, __FILE__, __LINE__, current); _lookup->foundObject(id, current.id.name, *proxy); } void LookupReplyI::foundAdapterById(string adapterId, optional proxy, bool isReplicaGroup, const Current& current) { - Ice::checkNotNull(proxy, current); + checkNotNull(proxy, __FILE__, __LINE__, current); _lookup->foundAdapter(adapterId, current.id.name, *proxy, isReplicaGroup); } diff --git a/cpp/src/IceStorm/NodeI.cpp b/cpp/src/IceStorm/NodeI.cpp index aa970d8fb50..023d87ca660 100644 --- a/cpp/src/IceStorm/NodeI.cpp +++ b/cpp/src/IceStorm/NodeI.cpp @@ -800,7 +800,7 @@ NodeI::ready( int64_t generation, const Ice::Current& current) { - Ice::checkNotNull(coordinator, current); + checkNotNull(coordinator, __FILE__, __LINE__, current); lock_guard lock(_mutex); if (!_destroy && _state == NodeState::NodeStateReorganization && _group == gn) { diff --git a/cpp/src/IceStorm/TopicI.cpp b/cpp/src/IceStorm/TopicI.cpp index f43a6231395..e0ecbca35e0 100644 --- a/cpp/src/IceStorm/TopicI.cpp +++ b/cpp/src/IceStorm/TopicI.cpp @@ -116,7 +116,7 @@ namespace optional subscribeAndGetPublisher(QoS qos, optional obj, const Ice::Current& current) override { - Ice::checkNotNull(obj, current); + checkNotNull(obj, __FILE__, __LINE__, current); while (true) { int64_t generation = -1; @@ -149,7 +149,7 @@ namespace void unsubscribe(optional subscriber, const Ice::Current& current) override { - Ice::checkNotNull(subscriber, current); + checkNotNull(subscriber, __FILE__, __LINE__, current); while (true) { int64_t generation = -1; diff --git a/cpp/src/IceStorm/TransientTopicI.cpp b/cpp/src/IceStorm/TransientTopicI.cpp index 999a9a83af9..3465eefe528 100644 --- a/cpp/src/IceStorm/TransientTopicI.cpp +++ b/cpp/src/IceStorm/TransientTopicI.cpp @@ -137,7 +137,7 @@ TransientTopicImpl::getNonReplicatedPublisher(const Ice::Current&) const optional TransientTopicImpl::subscribeAndGetPublisher(QoS qos, optional obj, const Ice::Current& current) { - Ice::checkNotNull(obj, current); + checkNotNull(obj, __FILE__, __LINE__, current); Ice::Identity id = obj->ice_getIdentity(); auto traceLevels = _instance->traceLevels(); @@ -183,7 +183,7 @@ TransientTopicImpl::subscribeAndGetPublisher(QoS qos, optional o void TransientTopicImpl::unsubscribe(optional subscriber, const Ice::Current& current) { - Ice::checkNotNull(subscriber, current); + checkNotNull(subscriber, __FILE__, __LINE__, current); Ice::Identity id = subscriber->ice_getIdentity(); auto traceLevels = _instance->traceLevels(); @@ -221,7 +221,7 @@ TransientTopicImpl::getLinkProxy(const Ice::Current&) void TransientTopicImpl::link(optional topic, int cost, const Ice::Current& current) { - Ice::checkNotNull(topic, current); + checkNotNull(topic, __FILE__, __LINE__, current); TopicInternalPrx internal(*topic); auto link = internal->getLinkProxy();