diff options
author | Marc Laukien <marc@zeroc.com> | 2004-02-16 14:50:37 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2004-02-16 14:50:37 +0000 |
commit | 8582bf17281769d6b58618018f2119f9dd520ac7 (patch) | |
tree | f714107e952bcb13c288b417c95cf6722825c2b4 /cpp/src/slice2java/Gen.cpp | |
parent | fix (diff) | |
download | ice-8582bf17281769d6b58618018f2119f9dd520ac7.tar.bz2 ice-8582bf17281769d6b58618018f2119f9dd520ac7.tar.xz ice-8582bf17281769d6b58618018f2119f9dd520ac7.zip |
fixes
Diffstat (limited to 'cpp/src/slice2java/Gen.cpp')
-rw-r--r-- | cpp/src/slice2java/Gen.cpp | 103 |
1 files changed, 39 insertions, 64 deletions
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 8de02feb5ac..f6ff122b56d 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -3104,10 +3104,6 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) { out << nl << "IceInternal.BasicStream __os = __out.os();"; } - if(!outParams.empty() || ret || !throws.empty()) - { - out << nl << "IceInternal.BasicStream __is = __out.is();"; - } iter = 0; for(q = inParams.begin(); q != inParams.end(); ++q) { @@ -3117,36 +3113,28 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) { out << nl << "__os.writePendingObjects();"; } - out << nl << "if(!__out.invoke())"; + out << nl << "boolean __ok = __out.invoke();"; + out << nl << "try"; + out << sb; + out << nl << "IceInternal.BasicStream __is = __out.is();"; + out << nl << "if(!__ok)"; out << sb; - if(!throws.empty()) - { - // - // The try/catch block is necessary because throwException() - // can raise UserException. - // - out << nl << "try"; - out << sb; - out << nl << "__is.throwException();"; - out << eb; - for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t) - { - out << nl << "catch(" << getAbsolute(*t, package) << " __ex)"; - out << sb; - out << nl << "throw __ex;"; - out << eb; - } - out << nl << "catch(Ice.UserException __ex)"; - out << sb; - out << eb; - } + out << nl << "try"; + out << sb; + out << nl << "__is.throwException();"; + out << eb; + for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t) + { + out << nl << "catch(" << getAbsolute(*t, package) << " __ex)"; + out << sb; + out << nl << "throw __ex;"; + out << eb; + } + out << nl << "catch(Ice.UserException __ex)"; + out << sb; out << nl << "throw new Ice.UnknownUserException();"; + out << eb; out << eb; - if(!outParams.empty() || ret) - { - out << nl << "try"; - out << sb; - } for(q = outParams.begin(); q != outParams.end(); ++q) { writeMarshalUnmarshalCode(out, package, q->first, fixKwd(q->second), false, iter, true); @@ -3181,14 +3169,11 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) out << nl << "return __ret;"; } } - if(!outParams.empty() || ret) - { - out << eb; - out << nl << "catch(Ice.LocalException __ex)"; - out << sb; - out << nl << "throw new IceInternal.NonRepeatable(__ex);"; - out << eb; - } + out << eb; + out << nl << "catch(Ice.LocalException __ex)"; + out << sb; + out << nl << "throw new IceInternal.NonRepeatable(__ex);"; + out << eb; out << eb; out << nl << "finally"; out << sb; @@ -3870,34 +3855,24 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) } out << nl << "try"; out << sb; - if(ret || !outParams.empty() || !throws.empty()) - { - out << nl << "IceInternal.BasicStream __is = this.__is();"; - } + out << nl << "IceInternal.BasicStream __is = this.__is();"; out << nl << "if(!__ok)"; out << sb; - if(!throws.empty()) - { - // - // The try/catch block is necessary because throwException() - // can raise UserException. - // - out << nl << "try"; - out << sb; - out << nl << "__is.throwException();"; - out << eb; - for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r) - { - out << nl << "catch(" << getAbsolute(*r, classPkg) << " __ex)"; - out << sb; - out << nl << "throw __ex;"; - out << eb; - } - out << nl << "catch(Ice.UserException __ex)"; - out << sb; - out << eb; - } + out << nl << "try"; + out << sb; + out << nl << "__is.throwException();"; + out << eb; + for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r) + { + out << nl << "catch(" << getAbsolute(*r, classPkg) << " __ex)"; + out << sb; + out << nl << "throw __ex;"; + out << eb; + } + out << nl << "catch(Ice.UserException __ex)"; + out << sb; out << nl << "throw new Ice.UnknownUserException();"; + out << eb; out << eb; for(q = outParams.begin(); q != outParams.end(); ++q) { |