diff options
-rw-r--r-- | cpp/include/Ice/Exception.h | 5 | ||||
-rw-r--r-- | cpp/src/Ice/Exception.cpp | 2 | ||||
-rwxr-xr-x | cpp/src/slice2cpp/Gen.cpp | 4 | ||||
-rwxr-xr-x | cpp/src/slice2cs/Gen.cpp | 31 | ||||
-rw-r--r-- | cpp/src/slice2java/Gen.cpp | 30 | ||||
-rw-r--r-- | cs/src/Ice/Exception.cs | 2 | ||||
-rw-r--r-- | java/src/Ice/SystemException.java | 13 |
7 files changed, 43 insertions, 44 deletions
diff --git a/cpp/include/Ice/Exception.h b/cpp/include/Ice/Exception.h index cf2b944d2d3..74e33d152c9 100644 --- a/cpp/include/Ice/Exception.h +++ b/cpp/include/Ice/Exception.h @@ -62,12 +62,15 @@ public: typedef ::IceInternal::Handle<UserException> UserExceptionPtr; -class ICE_API SystemException : public LocalException +class ICE_API SystemException : public IceUtil::Exception { public: SystemException(const char*, int); virtual ~SystemException() throw(); + virtual std::string ice_name() const = 0; + virtual Exception* ice_clone() const = 0; + virtual void ice_throw() const = 0; }; typedef ::IceInternal::Handle<SystemException> SystemExceptionPtr; diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp index c147357e62c..c930fca7b7e 100644 --- a/cpp/src/Ice/Exception.cpp +++ b/cpp/src/Ice/Exception.cpp @@ -53,7 +53,7 @@ Ice::LocalException::~LocalException() throw() } Ice::SystemException::SystemException(const char* file, int line) : - LocalException(file, line) + Exception(file, line) { } diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 65fd5a08e58..dbc34fc94f7 100755 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -3026,6 +3026,10 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p) C << nl << "throw;"; C << eb; } + C << nl << "catch(const ::Ice::SystemException&)"; + C << sb; + C << nl << "throw;"; + C << eb; C << nl << "catch(const ::IceInternal::LocalExceptionWrapper&)"; C << sb; C << nl << "throw;"; diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index dc23423563c..1192172a13e 100755 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -4150,6 +4150,9 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) _out << sb; _out << nl << "direct__ = new IceInternal.Direct(current__, run__);"; + _out << nl << "try"; + _out << sb; + _out << nl << "Ice.DispatchStatus status__ = direct__.servant().collocDispatch__(direct__);"; if(!throws.empty()) { @@ -4161,6 +4164,12 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << "_System.Diagnostics.Debug.Assert(status__ == Ice.DispatchStatus.DispatchOK);"; _out << eb; + _out << nl << "finally"; + _out << sb; + _out << nl << "direct__.destroy();"; + _out << eb; + _out << eb; + for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i) { _out << nl << "catch(" << fixId((*i)->scoped()) << ')'; @@ -4168,31 +4177,15 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << "throw;"; _out << eb; } - _out << nl << "catch(System.Exception ex__)"; - _out << sb; - _out << nl << "IceInternal.LocalExceptionWrapper.throwWrapper(ex__);"; - _out << eb; - _out << nl << "finally"; - _out << sb; - _out << nl << "if(direct__ != null)"; - _out << sb; - _out << nl << "try"; + _out << nl << "catch(Ice.SystemException)"; _out << sb; - _out << nl << "direct__.destroy();"; + _out << nl << "throw;"; _out << eb; - for(ExceptionList::const_iterator j = throws.begin(); j != throws.end(); ++j) - { - _out << nl << "catch(" << fixId((*j)->scoped()) << " ex__)"; - _out << sb; - _out << nl << "throw ex__;"; - _out << eb; - } _out << nl << "catch(System.Exception ex__)"; _out << sb; _out << nl << "IceInternal.LocalExceptionWrapper.throwWrapper(ex__);"; _out << eb; - _out << eb; - _out << eb; + // // // Set out parameters diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index dd285b1db1c..37fe9a2d6d8 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -4392,6 +4392,8 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) out << eb; out << ";"; + out << nl << "try"; + out << sb; out << sp << nl << "Ice.DispatchStatus __status = __direct.servant().__collocDispatch(__direct);"; out << nl << "if(__status == Ice.DispatchStatus.DispatchUserException)"; out << sb; @@ -4404,6 +4406,12 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) } out << eb; + out << nl << "finally"; + out << sb; + out << nl << "__direct.destroy();"; + out << eb; + + out << eb; for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t) { string exS = getAbsolute(*t, package); @@ -4413,33 +4421,15 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) out << eb; } - out << nl << "catch(java.lang.Throwable __ex)"; + out << nl << "catch(Ice.SystemException __ex)"; out << sb; - out << nl << "IceInternal.LocalExceptionWrapper.throwWrapper(__ex);"; + out << nl << "throw __ex;"; out << eb; - out << nl << "finally"; - out << sb; - out << nl << "if(__direct != null)"; - out << sb; - out << nl << "try"; - out << sb; - out << nl << "__direct.destroy();"; - out << eb; - for(ExceptionList::const_iterator k = throws.begin(); k != throws.end(); ++k) - { - string exS = getAbsolute(*k, package); - out << nl << "catch(" << exS << " __ex)"; - out << sb; - out << nl << "throw __ex;"; - out << eb; - } out << nl << "catch(java.lang.Throwable __ex)"; out << sb; out << nl << "IceInternal.LocalExceptionWrapper.throwWrapper(__ex);"; out << eb; - out << eb; - out << eb; } if(ret && !cl->hasMetaData("amd") && !op->hasMetaData("amd")) { diff --git a/cs/src/Ice/Exception.cs b/cs/src/Ice/Exception.cs index 99e986b88f1..4740c53cb72 100644 --- a/cs/src/Ice/Exception.cs +++ b/cs/src/Ice/Exception.cs @@ -78,7 +78,7 @@ namespace Ice public LocalException(System.Exception ex) : base(ex) {} } - public abstract class SystemException : LocalException + public abstract class SystemException : Exception { public SystemException() {} public SystemException(System.Exception ex) : base(ex) {} diff --git a/java/src/Ice/SystemException.java b/java/src/Ice/SystemException.java index f642be3992d..40bddded409 100644 --- a/java/src/Ice/SystemException.java +++ b/java/src/Ice/SystemException.java @@ -9,11 +9,20 @@ package Ice; -public abstract class SystemException extends LocalException implements Cloneable +public abstract class SystemException extends RuntimeException implements Cloneable { public java.lang.Object clone() { - return super.clone(); + java.lang.Object o = null; + try + { + o = super.clone(); + } + catch(CloneNotSupportedException ex) + { + assert false; // Impossible + } + return o; } public abstract String |