From 9cb5db6efbf5ff00b788b716c1150f519d858ca3 Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Thu, 7 Mar 2024 19:16:00 -0500 Subject: [PATCH] Remove system exceptions --- cpp/include/Ice/Exception.h | 32 ------------------------ cpp/src/Ice/CollocatedRequestHandler.cpp | 8 ------ cpp/src/Ice/CollocatedRequestHandler.h | 1 - cpp/src/Ice/ConnectionI.cpp | 6 ----- cpp/src/Ice/ConnectionI.h | 1 - cpp/src/Ice/Exception.cpp | 21 ---------------- cpp/src/Ice/Incoming.cpp | 9 ------- cpp/src/Ice/ResponseHandler.h | 1 - cpp/test/Ice/retry/AllTests.cpp | 30 ---------------------- cpp/test/Ice/retry/SystemFailure.h | 24 ------------------ cpp/test/Ice/retry/Test.ice | 1 - cpp/test/Ice/retry/TestI.cpp | 7 ------ cpp/test/Ice/retry/TestI.h | 1 - 13 files changed, 142 deletions(-) delete mode 100644 cpp/test/Ice/retry/SystemFailure.h diff --git a/cpp/include/Ice/Exception.h b/cpp/include/Ice/Exception.h index 8626337386c..acf93667cef 100644 --- a/cpp/include/Ice/Exception.h +++ b/cpp/include/Ice/Exception.h @@ -79,38 +79,6 @@ namespace Ice virtual void _readImpl(::Ice::InputStream*) {} /// \endcond }; - - /** - * Base class for all Ice system exceptions. - * - * System exceptions are currently Ice internal, non-documented - * exceptions. - * \headerfile Ice/Ice.h - */ - class ICE_API SystemException : public IceUtil::Exception - { - public: - /** - * The file and line number are required for all local exceptions. - * @param file The file name in which the exception was raised, typically __FILE__. - * @param line The line number at which the exception was raised, typically __LINE__. - */ - SystemException(const char* file, int line); - SystemException(const SystemException&) = default; - virtual ~SystemException(); - - /** - * Polymorphically clones this exception. - * @return A shallow copy of this exception. - */ - std::unique_ptr ice_clone() const; - - /** - * Obtains the Slice type ID of this exception. - * @return The fully-scoped type ID. - */ - static std::string_view ice_staticId(); - }; } namespace IceInternal diff --git a/cpp/src/Ice/CollocatedRequestHandler.cpp b/cpp/src/Ice/CollocatedRequestHandler.cpp index 6551c9a84c4..d57226017ba 100644 --- a/cpp/src/Ice/CollocatedRequestHandler.cpp +++ b/cpp/src/Ice/CollocatedRequestHandler.cpp @@ -246,14 +246,6 @@ CollocatedRequestHandler::sendNoResponse() _adapter->decDirectCount(); } -bool -CollocatedRequestHandler::systemException(int32_t requestId, exception_ptr ex, bool amd) -{ - handleException(requestId, ex, amd); - _adapter->decDirectCount(); - return true; -} - void CollocatedRequestHandler::invokeException(int32_t requestId, exception_ptr ex, int /*invokeNum*/, bool amd) { diff --git a/cpp/src/Ice/CollocatedRequestHandler.h b/cpp/src/Ice/CollocatedRequestHandler.h index e50410ac9a3..f2dceeb1436 100644 --- a/cpp/src/Ice/CollocatedRequestHandler.h +++ b/cpp/src/Ice/CollocatedRequestHandler.h @@ -37,7 +37,6 @@ namespace IceInternal virtual void sendResponse(std::int32_t, Ice::OutputStream*, std::uint8_t, bool); virtual void sendNoResponse(); - virtual bool systemException(std::int32_t, std::exception_ptr, bool); virtual void invokeException(std::int32_t, std::exception_ptr, int, bool); virtual Ice::ConnectionIPtr getConnection(); diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 2949c051096..7edfbb9bd39 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -1169,12 +1169,6 @@ Ice::ConnectionI::sendNoResponse() } } -bool -Ice::ConnectionI::systemException(int32_t, std::exception_ptr, bool /*amd*/) -{ - return false; // System exceptions aren't marshalled. -} - void Ice::ConnectionI::invokeException(int32_t, exception_ptr ex, int invokeNum, bool /*amd*/) { diff --git a/cpp/src/Ice/ConnectionI.h b/cpp/src/Ice/ConnectionI.h index b13a38a5c90..94a583300d0 100644 --- a/cpp/src/Ice/ConnectionI.h +++ b/cpp/src/Ice/ConnectionI.h @@ -176,7 +176,6 @@ namespace Ice virtual void sendResponse(std::int32_t, Ice::OutputStream*, std::uint8_t, bool); virtual void sendNoResponse(); - virtual bool systemException(std::int32_t, std::exception_ptr, bool); virtual void invokeException(std::int32_t, std::exception_ptr, int, bool); IceInternal::EndpointIPtr endpoint() const; diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp index 9b04da433e6..a37cf0e8892 100644 --- a/cpp/src/Ice/Exception.cpp +++ b/cpp/src/Ice/Exception.cpp @@ -132,27 +132,6 @@ Ice::LocalException::ice_staticId() return localException_ids[0]; } -Ice::SystemException::SystemException(const char* file, int line) : Exception(file, line) {} - -Ice::SystemException::~SystemException() {} - -unique_ptr -Ice::SystemException::ice_clone() const -{ - return unique_ptr(static_cast(ice_cloneImpl())); -} - -namespace -{ - const string systemException_ids[] = {"::Ice::SystemException"}; -} - -std::string_view -Ice::SystemException::ice_staticId() -{ - return systemException_ids[0]; -} - void Ice::InitializationException::ice_print(ostream& out) const { diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index d6f7e1bee1e..4a50a078e0c 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -396,15 +396,6 @@ Incoming::handleException(std::exception_ptr exc, bool amd) } catch (const Exception& ex) { - if (dynamic_cast(&ex)) - { - if (_responseHandler->systemException(_current.requestId, exc, amd)) - { - return; - } - // else, keep going - } - if (_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) { warning(ex); diff --git a/cpp/src/Ice/ResponseHandler.h b/cpp/src/Ice/ResponseHandler.h index f7d6cd58e30..37e1f96913c 100644 --- a/cpp/src/Ice/ResponseHandler.h +++ b/cpp/src/Ice/ResponseHandler.h @@ -22,7 +22,6 @@ namespace IceInternal public: virtual void sendResponse(std::int32_t, Ice::OutputStream*, std::uint8_t, bool) = 0; virtual void sendNoResponse() = 0; - virtual bool systemException(std::int32_t, std::exception_ptr, bool) = 0; virtual void invokeException(std::int32_t, std::exception_ptr, int, bool) = 0; }; } diff --git a/cpp/test/Ice/retry/AllTests.cpp b/cpp/test/Ice/retry/AllTests.cpp index 182a6dba315..14a50f7e849 100644 --- a/cpp/test/Ice/retry/AllTests.cpp +++ b/cpp/test/Ice/retry/AllTests.cpp @@ -6,7 +6,6 @@ #include #include #include -#include using namespace std; using namespace Test; @@ -221,35 +220,6 @@ allTests(const Ice::CommunicatorPtr& communicator, const Ice::CommunicatorPtr& c testRetryCount(0); cout << "ok" << endl; - if (!retry1->ice_getConnection()) - { - testInvocationCount(-1); - cout << "testing system exception... " << flush; - try - { - retry1->opSystemException(); - test(false); - } - catch (const SystemFailure&) - { - } - testInvocationCount(1); - testFailureCount(1); - testRetryCount(0); - try - { - retry1->opSystemExceptionAsync().get(); - test(false); - } - catch (const SystemFailure&) - { - } - testInvocationCount(1); - testFailureCount(1); - testRetryCount(0); - cout << "ok" << endl; - } - { cout << "testing invocation timeout and retries... " << flush; retry2 = RetryPrx(communicator2, retry1->ice_toString()); diff --git a/cpp/test/Ice/retry/SystemFailure.h b/cpp/test/Ice/retry/SystemFailure.h deleted file mode 100644 index 2b9ae2a6867..00000000000 --- a/cpp/test/Ice/retry/SystemFailure.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#ifndef SYSTEMFAILURE_H -#define SYSTEMFAILURE_H - -#include - -class SystemFailure : public Ice::SystemException -{ -public: - SystemFailure(const char* file, int line) : Ice::SystemException(file, line) {} - - SystemFailure(const SystemFailure& ex) : Ice::SystemException(ex.ice_file(), ex.ice_line()) {} - - virtual std::string ice_id() const { return "SystemFailure"; } - - virtual IceUtil::Exception* ice_cloneImpl() const { return new SystemFailure(*this); } - - virtual void ice_throw() const { throw SystemFailure(*this); } -}; - -#endif diff --git a/cpp/test/Ice/retry/Test.ice b/cpp/test/Ice/retry/Test.ice index de03d65aaf5..619df58edac 100644 --- a/cpp/test/Ice/retry/Test.ice +++ b/cpp/test/Ice/retry/Test.ice @@ -13,7 +13,6 @@ interface Retry idempotent int opIdempotent(int c); void opNotIdempotent(); - void opSystemException(); idempotent void sleep(int delay); diff --git a/cpp/test/Ice/retry/TestI.cpp b/cpp/test/Ice/retry/TestI.cpp index 13658b732f6..22a4f05e840 100644 --- a/cpp/test/Ice/retry/TestI.cpp +++ b/cpp/test/Ice/retry/TestI.cpp @@ -5,7 +5,6 @@ #include #include -#include #include using namespace std; @@ -53,12 +52,6 @@ RetryI::opNotIdempotent(const Ice::Current&) throw Ice::ConnectionLostException(__FILE__, __LINE__); } -void -RetryI::opSystemException(const Ice::Current&) -{ - throw SystemFailure(__FILE__, __LINE__); -} - void RetryI::sleep(int delay, const Ice::Current&) { diff --git a/cpp/test/Ice/retry/TestI.h b/cpp/test/Ice/retry/TestI.h index 7cd1eb4ee1f..7993a52f5aa 100644 --- a/cpp/test/Ice/retry/TestI.h +++ b/cpp/test/Ice/retry/TestI.h @@ -15,7 +15,6 @@ class RetryI : public Test::Retry virtual void op(bool, const Ice::Current&); virtual int opIdempotent(int, const Ice::Current&); virtual void opNotIdempotent(const Ice::Current&); - virtual void opSystemException(const Ice::Current&); virtual void sleep(int, const Ice::Current&); virtual void shutdown(const Ice::Current&);