summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/CHANGES21
-rw-r--r--cpp/include/Freeze/Initialize.h2
-rw-r--r--cpp/include/Ice/Exception.h13
-rw-r--r--cpp/include/Ice/Outgoing.h2
-rw-r--r--cpp/src/Freeze/TransactionalEvictorContext.cpp2
-rw-r--r--cpp/src/Ice/Exception.cpp16
-rw-r--r--cpp/src/Ice/Outgoing.cpp18
-rw-r--r--cpp/src/Ice/Proxy.cpp16
-rwxr-xr-xcpp/src/slice2cpp/Gen.cpp4
-rwxr-xr-xcpp/src/slice2cs/Gen.cpp4
-rw-r--r--cpp/src/slice2java/Gen.cpp23
-rw-r--r--cpp/test/Ice/exceptions/AllTests.cpp5
-rw-r--r--cpp/test/Ice/interceptor/Client.cpp7
-rw-r--r--cpp/test/Ice/servantLocator/AllTests.cpp9
14 files changed, 75 insertions, 67 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES
index bc9d442f3d4..dbbe25836ea 100644
--- a/cpp/CHANGES
+++ b/cpp/CHANGES
@@ -11,6 +11,27 @@ Changes since version 3.2.X (binary incompatible)
- Added support for string concatenation in FreezeScript using the
'+' operator.
+- Exceptions thrown from collocation-optimized invocations are now
+ fully transparent. If an operation throws an exception that is
+ not in the operation's exception specification, or throws a
+ non-Ice exception, the client receives UnknownUserException
+ or UnknownException, exactly as if the servant for a remote
+ invocation had thrown the same exception. (In earlier versions,
+ the client received the orginal exception, rather than an
+ unknown exception.)
+
+ For Ice run-time exceptions, all run-time exceptions are passed
+ to the client as UnknownLocalException, except for
+
+ - ObjectNotExistException
+ - FacetNotExistException
+ - OperationNotExistException
+ - OperationNotExistException
+ - UnknownException
+ - UnknownLocalException
+ - UnknownUserException
+ - CollocationOptimizationException
+
- Changed servant locators so both locate() and finished() can
throw user exceptions. (See the manual for details.)
diff --git a/cpp/include/Freeze/Initialize.h b/cpp/include/Freeze/Initialize.h
index e71e051ab74..14d586aa449 100644
--- a/cpp/include/Freeze/Initialize.h
+++ b/cpp/include/Freeze/Initialize.h
@@ -75,7 +75,7 @@ createTransactionalEvictor(const Ice::ObjectAdapterPtr& adapter,
// TransactionalEvictorDeadlockException propagates through collocation-optimized calls
// The TransactionalEvictor catches and retries on this exception
//
-class FREEZE_API TransactionalEvictorDeadlockException : public Ice::LocalException
+class FREEZE_API TransactionalEvictorDeadlockException : public Ice::SystemException
{
public:
diff --git a/cpp/include/Ice/Exception.h b/cpp/include/Ice/Exception.h
index a1814049dc1..cf2b944d2d3 100644
--- a/cpp/include/Ice/Exception.h
+++ b/cpp/include/Ice/Exception.h
@@ -61,6 +61,18 @@ public:
typedef ::IceInternal::Handle<UserException> UserExceptionPtr;
+
+class ICE_API SystemException : public LocalException
+{
+public:
+
+ SystemException(const char*, int);
+ virtual ~SystemException() throw();
+};
+
+typedef ::IceInternal::Handle<SystemException> SystemExceptionPtr;
+
+
#if defined(__SUNPRO_CC)
//
// COMPILERFIX: With Sun CC the presence of the overloaded operator
@@ -78,6 +90,7 @@ typedef ::IceInternal::Handle<UserException> UserExceptionPtr;
//
ICE_API std::ostream& operator<<(std::ostream&, const LocalException&);
ICE_API std::ostream& operator<<(std::ostream&, const UserException&);
+ICE_API std::ostream& operator<<(std::ostream&, const SystemException&);
#endif
}
diff --git a/cpp/include/Ice/Outgoing.h b/cpp/include/Ice/Outgoing.h
index b190d64846f..c2cdfc040b3 100644
--- a/cpp/include/Ice/Outgoing.h
+++ b/cpp/include/Ice/Outgoing.h
@@ -49,7 +49,7 @@ public:
//
bool retry() const;
- static void throwUnknownWrapper(const ::std::exception&);
+ static void throwWrapper(const ::std::exception&);
private:
diff --git a/cpp/src/Freeze/TransactionalEvictorContext.cpp b/cpp/src/Freeze/TransactionalEvictorContext.cpp
index 2c68a4eae2e..99fd3ecdafa 100644
--- a/cpp/src/Freeze/TransactionalEvictorContext.cpp
+++ b/cpp/src/Freeze/TransactionalEvictorContext.cpp
@@ -24,7 +24,7 @@ using namespace Ice;
//
Freeze::TransactionalEvictorDeadlockException::TransactionalEvictorDeadlockException(const char* file, int line, const TransactionPtr& transaction) :
- Ice::LocalException(file, line),
+ Ice::SystemException(file, line),
tx(transaction)
{
}
diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp
index 2510db8cffa..c147357e62c 100644
--- a/cpp/src/Ice/Exception.cpp
+++ b/cpp/src/Ice/Exception.cpp
@@ -52,6 +52,15 @@ Ice::LocalException::~LocalException() throw()
{
}
+Ice::SystemException::SystemException(const char* file, int line) :
+ LocalException(file, line)
+{
+}
+
+Ice::SystemException::~SystemException() throw()
+{
+}
+
#if defined(__SUNPRO_CC)
ostream&
Ice::operator<<(ostream& out, const Ice::UserException& ex)
@@ -66,6 +75,13 @@ Ice::operator<<(ostream& out, const Ice::LocalException& ex)
ex.ice_print(out);
return out;
}
+
+ostream&
+Ice::operator<<(ostream& out, const Ice::SystemException& ex)
+{
+ ex.ice_print(out);
+ return out;
+}
#endif
void
diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp
index a46a4e9b0bb..8eedeffe6a1 100644
--- a/cpp/src/Ice/Outgoing.cpp
+++ b/cpp/src/Ice/Outgoing.cpp
@@ -34,7 +34,7 @@ IceInternal::LocalExceptionWrapper::LocalExceptionWrapper(const LocalExceptionWr
}
void
-IceInternal::LocalExceptionWrapper::throwUnknownWrapper(const std::exception& ex)
+IceInternal::LocalExceptionWrapper::throwWrapper(const std::exception& ex)
{
const UserException* ue = dynamic_cast<const UserException*>(&ex);
@@ -48,31 +48,21 @@ IceInternal::LocalExceptionWrapper::throwUnknownWrapper(const std::exception& ex
const LocalException* le = dynamic_cast<const LocalException*>(&ex);
if(le)
{
-#if 0
- //
- // Commented-out code makes local exceptions fully location transparent,
- // but the Freeze evictor relies on them not being transparent.
- //
if(dynamic_cast<const UnknownException*>(le) ||
dynamic_cast<const ObjectNotExistException*>(le) ||
dynamic_cast<const OperationNotExistException*>(le) ||
- dynamic_cast<const FacetNotExistException*>(le))
+ dynamic_cast<const FacetNotExistException*>(le) ||
+ dynamic_cast<const CollocationOptimizationException*>(le) ||
+ dynamic_cast<const SystemException*>(le))
{
throw LocalExceptionWrapper(*le, false);
}
stringstream s;
s << *le;
throw LocalExceptionWrapper(UnknownLocalException(__FILE__, __LINE__, s.str()), false);
-#else
- throw LocalExceptionWrapper(*le, false);
-#endif
}
-#if 0
string msg = "std::exception: ";
throw LocalExceptionWrapper(UnknownException(__FILE__, __LINE__, msg + ex.what()), false);
-#else
- throw ex;
-#endif
}
const LocalException*
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp
index 35ee8cae257..4d986ef0abc 100644
--- a/cpp/src/Ice/Proxy.cpp
+++ b/cpp/src/Ice/Proxy.cpp
@@ -1357,7 +1357,7 @@ IceDelegateD::Ice::Object::ice_isA(const string& __id, const Context* context)
catch(const ::std::exception& __ex)
{
__direct.destroy();
- LocalExceptionWrapper::throwUnknownWrapper(__ex);
+ LocalExceptionWrapper::throwWrapper(__ex);
}
catch(...)
{
@@ -1372,7 +1372,7 @@ IceDelegateD::Ice::Object::ice_isA(const string& __id, const Context* context)
}
catch(const ::std::exception& __ex)
{
- LocalExceptionWrapper::throwUnknownWrapper(__ex);
+ LocalExceptionWrapper::throwWrapper(__ex);
}
catch(...)
{
@@ -1415,7 +1415,7 @@ IceDelegateD::Ice::Object::ice_ping(const ::Ice::Context* context)
catch(const ::std::exception& __ex)
{
__direct.destroy();
- LocalExceptionWrapper::throwUnknownWrapper(__ex);
+ LocalExceptionWrapper::throwWrapper(__ex);
}
catch(...)
{
@@ -1430,7 +1430,7 @@ IceDelegateD::Ice::Object::ice_ping(const ::Ice::Context* context)
}
catch(const ::std::exception& __ex)
{
- LocalExceptionWrapper::throwUnknownWrapper(__ex);
+ LocalExceptionWrapper::throwWrapper(__ex);
}
catch(...)
{
@@ -1478,7 +1478,7 @@ IceDelegateD::Ice::Object::ice_ids(const ::Ice::Context* context)
catch(const ::std::exception& __ex)
{
__direct.destroy();
- LocalExceptionWrapper::throwUnknownWrapper(__ex);
+ LocalExceptionWrapper::throwWrapper(__ex);
}
catch(...)
{
@@ -1493,7 +1493,7 @@ IceDelegateD::Ice::Object::ice_ids(const ::Ice::Context* context)
}
catch(const ::std::exception& __ex)
{
- LocalExceptionWrapper::throwUnknownWrapper(__ex);
+ LocalExceptionWrapper::throwWrapper(__ex);
}
catch(...)
{
@@ -1542,7 +1542,7 @@ IceDelegateD::Ice::Object::ice_id(const ::Ice::Context* context)
catch(const ::std::exception& __ex)
{
__direct.destroy();
- LocalExceptionWrapper::throwUnknownWrapper(__ex);
+ LocalExceptionWrapper::throwWrapper(__ex);
}
catch(...)
{
@@ -1557,7 +1557,7 @@ IceDelegateD::Ice::Object::ice_id(const ::Ice::Context* context)
}
catch(const ::std::exception& __ex)
{
- LocalExceptionWrapper::throwUnknownWrapper(__ex);
+ LocalExceptionWrapper::throwWrapper(__ex);
}
catch(...)
{
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index a608a38648b..b05911e333e 100755
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -2991,7 +2991,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
C << nl << "catch(const ::std::exception& __ex)";
C << sb;
C << nl << "__direct.destroy();";
- C << nl << "::IceInternal::LocalExceptionWrapper::throwUnknownWrapper(__ex);";
+ C << nl << "::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);";
C << eb;
C << nl << "catch(...)";
C << sb;
@@ -3020,7 +3020,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
C << eb;
C << nl << "catch(const ::std::exception& __ex)";
C << sb;
- C << nl << "::IceInternal::LocalExceptionWrapper::throwUnknownWrapper(__ex);";
+ C << nl << "::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);";
C << eb;
C << nl << "catch(...)";
C << sb;
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index a79a7f8333e..d705191ed2b 100755
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -4170,7 +4170,7 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
}
_out << nl << "catch(System.Exception ex__)";
_out << sb;
- _out << nl << "IceInternal.LocalExceptionWrapper.throwUnknownWrapper(ex__);";
+ _out << nl << "IceInternal.LocalExceptionWrapper.throwWrapper(ex__);";
_out << eb;
_out << nl << "finally";
_out << sb;
@@ -4189,7 +4189,7 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
}
_out << nl << "catch(System.Exception ex__)";
_out << sb;
- _out << nl << "IceInternal.LocalExceptionWrapper.throwUnknownWrapper(ex__);";
+ _out << nl << "IceInternal.LocalExceptionWrapper.throwWrapper(ex__);";
_out << eb;
_out << eb;
_out << eb;
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 64870af0e4f..02d2686e84b 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -4417,28 +4417,11 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
out << eb;
}
- //
- // Next two catch handlers keep local exceptions non-transparent.
- //
- out << nl << "catch(Ice.UserException __ex)";
- out << sb;
- out << nl << "IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);";
- out << eb;
- out << nl << "catch(Ice.LocalException __ex)";
+ out << nl << "catch(java.lang.Throwable __ex)";
out << sb;
- out << nl << "IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);";
+ out << nl << "IceInternal.LocalExceptionWrapper.throwWrapper(__ex);";
out << eb;
- /*
- //
- // Commented-out code makes local exceptions fully location transparent,
- // but the Freeze evictor relies on them being non-transparent.
- //
- out << nl << "catch(Ice.LocalException __ex)";
- out << sb;
- out << nl << "IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);";
- out << eb;
- */
out << nl << "finally";
out << sb;
out << nl << "if(__direct != null)";
@@ -4457,7 +4440,7 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
}
out << nl << "catch(java.lang.Throwable __ex)";
out << sb;
- out << nl << "IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);";
+ out << nl << "IceInternal.LocalExceptionWrapper.throwWrapper(__ex);";
out << eb;
out << eb;
out << eb;
diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp
index 457169e9609..ffd4d9165e9 100644
--- a/cpp/test/Ice/exceptions/AllTests.cpp
+++ b/cpp/test/Ice/exceptions/AllTests.cpp
@@ -1069,11 +1069,6 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
}
catch(const Ice::UnknownLocalException&)
{
- test(!collocated);
- }
- catch(const Ice::TimeoutException&)
- {
- test(collocated);
}
catch(...)
{
diff --git a/cpp/test/Ice/interceptor/Client.cpp b/cpp/test/Ice/interceptor/Client.cpp
index ab0c96e883c..e1c0256c111 100644
--- a/cpp/test/Ice/interceptor/Client.cpp
+++ b/cpp/test/Ice/interceptor/Client.cpp
@@ -131,13 +131,12 @@ Client::run(const Test::MyObjectPrx& prx, const InterceptorIPtr& interceptor)
prx->badSystemAdd(33, 12);
test(false);
}
- catch(const Ice::InitializationException&)
+ catch(const Ice::UnknownLocalException&)
{
- test(prx->ice_isCollocationOptimized());
}
- catch(const Ice::UnknownLocalException&)
+ catch(...)
{
- test(!prx->ice_isCollocationOptimized());
+ test(false);
}
test(interceptor->getLastOperation() == "badSystemAdd");
cout << "ok" << endl;
diff --git a/cpp/test/Ice/servantLocator/AllTests.cpp b/cpp/test/Ice/servantLocator/AllTests.cpp
index b8ff76f3722..b91db6824e9 100644
--- a/cpp/test/Ice/servantLocator/AllTests.cpp
+++ b/cpp/test/Ice/servantLocator/AllTests.cpp
@@ -101,13 +101,8 @@ testExceptions(const TestIntfPrx& obj, bool collocated)
}
catch(const UnknownLocalException& ex)
{
- test(!collocated);
test(ex.unknown.find("Ice::SocketException:\nsocket exception: unknown error") != string::npos);
}
- catch(const SocketException&)
- {
- test(collocated);
- }
catch(...)
{
test(false);
@@ -120,12 +115,8 @@ testExceptions(const TestIntfPrx& obj, bool collocated)
}
catch(const UnknownException& ex)
{
- test(!collocated);
test(ex.unknown == "std::exception: Hello");
}
- catch(const ::std::exception&)
- {
- }
catch(...)
{
test(false);