summaryrefslogtreecommitdiff
path: root/cpp/src/slice2java/Gen.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2009-12-04 10:02:20 +0100
committerBenoit Foucher <benoit@zeroc.com>2009-12-04 10:02:20 +0100
commit97b8898f58ca33ccbf8a24d483c6a7e530c4ac21 (patch)
tree89e4e9d041999d4c0c1b54607826e65e85340fac /cpp/src/slice2java/Gen.cpp
parent4089 - IceGrid database corruption. (diff)
downloadice-97b8898f58ca33ccbf8a24d483c6a7e530c4ac21.tar.bz2
ice-97b8898f58ca33ccbf8a24d483c6a7e530c4ac21.tar.xz
ice-97b8898f58ca33ccbf8a24d483c6a7e530c4ac21.zip
Fixed bug 4426 and 4409
Diffstat (limited to 'cpp/src/slice2java/Gen.cpp')
-rw-r--r--cpp/src/slice2java/Gen.cpp50
1 files changed, 43 insertions, 7 deletions
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 7afd33900ea..27d534ce518 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -3861,12 +3861,12 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "private Ice.AsyncResult begin_" << op->name() << spar << inParams << contextParam
<< "boolean __explicitCtx" << "IceInternal.CallbackBase __cb" << epar;
out << sb;
- out << nl << "IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __" << op->name()
- << "_name, __cb);";
if(op->returnsData())
{
- out << nl << "__checkTwowayOnly(__" << op->name() << "_name);";
+ out << nl << "__checkAsyncTwowayOnly(__" << op->name() << "_name);";
}
+ out << nl << "IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __" << op->name()
+ << "_name, __cb);";
out << nl << "try";
out << sb;
out << nl << "__result.__prepare(__" << op->name() << "_name, " << sliceModeToIceMode(op->mode())
@@ -4023,8 +4023,26 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
writeDocCommentAsync(out, op, InParam);
out << nl << "public boolean" << nl << op->name() << "_async" << spar << paramsAMI << epar;
out << sb;
- out << nl << "Ice.AsyncResult __r = begin_" << op->name() << spar << argsAMI << "null" << "false"
- << "__cb" << epar << ';';
+ if(op->returnsData())
+ {
+ out << nl << "Ice.AsyncResult __r;";
+ out << nl << "try";
+ out << sb;
+ out << nl << "__checkTwowayOnly(__" << op->name() << "_name);";
+ out << nl << "__r = begin_" << op->name() << spar << argsAMI << "null" << "false"
+ << "__cb" << epar << ';';
+ out << eb;
+ out << nl << "catch(Ice.TwowayOnlyException ex)";
+ out << sb;
+ out << nl << "__r = new IceInternal.OutgoingAsync(this, __" << op->name() << "_name, __cb);";
+ out << nl << "__r.__exceptionAsync(ex);";
+ out << eb;
+ }
+ else
+ {
+ out << nl << "Ice.AsyncResult __r = begin_" << op->name() << spar << argsAMI << "null" << "false"
+ << "__cb" << epar << ';';
+ }
out << nl << "return __r.sentSynchronously();";
out << eb;
@@ -4032,8 +4050,26 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
writeDocCommentAsync(out, op, InParam, contextDoc);
out << nl << "public boolean" << nl << op->name() << "_async" << spar << paramsAMI << contextParam << epar;
out << sb;
- out << nl << "Ice.AsyncResult __r = begin_" << op->name() << spar << argsAMI << "__ctx" << "true"
- << "__cb" << epar << ';';
+ if(op->returnsData())
+ {
+ out << nl << "Ice.AsyncResult __r;";
+ out << nl << "try";
+ out << sb;
+ out << nl << "__checkTwowayOnly(__" << op->name() << "_name);";
+ out << nl << "__r = begin_" << op->name() << spar << argsAMI << "__ctx" << "true"
+ << "__cb" << epar << ';';
+ out << eb;
+ out << nl << "catch(Ice.TwowayOnlyException ex)";
+ out << sb;
+ out << nl << "__r = new IceInternal.OutgoingAsync(this, __" << op->name() << "_name, __cb);";
+ out << nl << "__r.__exceptionAsync(ex);";
+ out << eb;
+ }
+ else
+ {
+ out << nl << "Ice.AsyncResult __r = begin_" << op->name() << spar << argsAMI << "__ctx" << "true"
+ << "__cb" << epar << ';';
+ }
out << nl << "return __r.sentSynchronously();";
out << eb;
}