summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/slice2cs/Gen.cpp3
-rw-r--r--cpp/src/slice2java/Gen.cpp3
-rw-r--r--cpp/test/Ice/exceptions/AllTests.cpp47
-rw-r--r--cpp/test/Ice/exceptions/Client.cpp5
-rw-r--r--cpp/test/Ice/exceptions/Server.cpp10
-rw-r--r--cpp/test/Ice/exceptions/ServerAMD.cpp10
-rw-r--r--cpp/test/Ice/exceptions/Test.ice3
-rw-r--r--cpp/test/Ice/exceptions/TestAMD.ice3
-rw-r--r--cpp/test/Ice/exceptions/TestAMDI.cpp8
-rw-r--r--cpp/test/Ice/exceptions/TestAMDI.h2
-rw-r--r--cpp/test/Ice/exceptions/TestI.cpp6
-rw-r--r--cpp/test/Ice/exceptions/TestI.h1
12 files changed, 90 insertions, 11 deletions
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index 60164571d5e..31ebf05c673 100644
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -6619,7 +6619,8 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
_out << eb;
_out << nl << "catch(Ice.LocalException ex__)";
_out << sb;
- _out << nl << "ice_exception(ex__);";
+ _out << nl << "exception__(ex__);";
+ _out << nl << "return;";
_out << eb;
}
else
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 88630bc79b5..fa2f0781a0e 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -6877,7 +6877,8 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
out << eb;
out << nl << "catch(Ice.LocalException __ex)";
out << sb;
- out << nl << "ice_exception(__ex);";
+ out << nl << "__exception(__ex);";
+ out << nl << "return;";
out << eb;
}
else
diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp
index 8834c89ecad..caf331f30ff 100644
--- a/cpp/test/Ice/exceptions/AllTests.cpp
+++ b/cpp/test/Ice/exceptions/AllTests.cpp
@@ -1343,6 +1343,53 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
cout << "ok" << endl;
}
+ {
+ cout << "testing memory limit marshal exception..." << flush;
+ try
+ {
+ thrower->throwMemoryLimitException(Ice::ByteSeq());
+ test(collocated);
+ }
+ catch(const Ice::UnknownLocalException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+
+ try
+ {
+ thrower->throwMemoryLimitException(Ice::ByteSeq(20 * 1024)); // 20KB
+ test(collocated);
+ }
+ catch(const Ice::MemoryLimitException& ex)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+
+ if(!collocated)
+ {
+ try
+ {
+ thrower->end_throwMemoryLimitException(
+ thrower->begin_throwMemoryLimitException(Ice::ByteSeq(20 * 1024))); // 20KB
+ test(false);
+ }
+ catch(const Ice::MemoryLimitException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ }
+ cout << "ok" << endl;
+ }
+
cout << "catching object not exist exception... " << flush;
Ice::Identity id = communicator->stringToIdentity("does not exist");
diff --git a/cpp/test/Ice/exceptions/Client.cpp b/cpp/test/Ice/exceptions/Client.cpp
index f7e933a4dca..2fbacc09b8f 100644
--- a/cpp/test/Ice/exceptions/Client.cpp
+++ b/cpp/test/Ice/exceptions/Client.cpp
@@ -33,7 +33,10 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties();
+ initData.properties->setProperty("Ice.MessageSizeMax", "10"); // 10KB max
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/exceptions/Server.cpp b/cpp/test/Ice/exceptions/Server.cpp
index 629eacaeae8..61be1c3e69c 100644
--- a/cpp/test/Ice/exceptions/Server.cpp
+++ b/cpp/test/Ice/exceptions/Server.cpp
@@ -18,9 +18,6 @@ using namespace std;
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
- Ice::PropertiesPtr properties = communicator->getProperties();
- properties->setProperty("Ice.Warn.Dispatch", "0");
- communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::ObjectPtr object = new ThrowerI();
adapter->add(object, communicator->stringToIdentity("thrower"));
@@ -38,7 +35,12 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties();
+ initData.properties->setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ initData.properties->setProperty("Ice.MessageSizeMax", "10"); // 10KB max
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/exceptions/ServerAMD.cpp b/cpp/test/Ice/exceptions/ServerAMD.cpp
index d859d9f43f2..8ff4d67d825 100644
--- a/cpp/test/Ice/exceptions/ServerAMD.cpp
+++ b/cpp/test/Ice/exceptions/ServerAMD.cpp
@@ -18,9 +18,6 @@ using namespace std;
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
- Ice::PropertiesPtr properties = communicator->getProperties();
- properties->setProperty("Ice.Warn.Dispatch", "0");
- communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::ObjectPtr object = new ThrowerI();
adapter->add(object, communicator->stringToIdentity("thrower"));
@@ -38,7 +35,12 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties();
+ initData.properties->setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ initData.properties->setProperty("Ice.MessageSizeMax", "10"); // 10KB max
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/exceptions/Test.ice b/cpp/test/Ice/exceptions/Test.ice
index 9ef2874491a..a4952489338 100644
--- a/cpp/test/Ice/exceptions/Test.ice
+++ b/cpp/test/Ice/exceptions/Test.ice
@@ -9,6 +9,8 @@
#pragma once
+#include <Ice/BuiltinSequences.ice>
+
module Test
{
@@ -90,6 +92,7 @@ module Mod
void throwLocalException();
void throwNonIceException();
void throwAssertException();
+ Ice::ByteSeq throwMemoryLimitException(Ice::ByteSeq seq);
idempotent void throwLocalExceptionIdempotent();
diff --git a/cpp/test/Ice/exceptions/TestAMD.ice b/cpp/test/Ice/exceptions/TestAMD.ice
index 25928f2076d..54052291e0f 100644
--- a/cpp/test/Ice/exceptions/TestAMD.ice
+++ b/cpp/test/Ice/exceptions/TestAMD.ice
@@ -9,6 +9,8 @@
#pragma once
+#include <Ice/BuiltinSequences.ice>
+
module Test
{
@@ -91,6 +93,7 @@ module Mod
void throwLocalException();
void throwNonIceException();
void throwAssertException();
+ Ice::ByteSeq throwMemoryLimitException(Ice::ByteSeq seq);
idempotent void throwLocalExceptionIdempotent();
diff --git a/cpp/test/Ice/exceptions/TestAMDI.cpp b/cpp/test/Ice/exceptions/TestAMDI.cpp
index 8e37e9061f6..67786170906 100644
--- a/cpp/test/Ice/exceptions/TestAMDI.cpp
+++ b/cpp/test/Ice/exceptions/TestAMDI.cpp
@@ -196,6 +196,14 @@ ThrowerI::throwAssertException_async(const AMD_Thrower_throwAssertExceptionPtr&,
}
void
+ThrowerI::throwMemoryLimitException_async(const AMD_Thrower_throwMemoryLimitExceptionPtr& cb,
+ const Ice::ByteSeq&, const Ice::Current&)
+{
+ cb->ice_response(Ice::ByteSeq(1024 * 20)); // 20 KB.
+}
+
+
+void
ThrowerI::throwLocalExceptionIdempotent_async(const AMD_Thrower_throwLocalExceptionIdempotentPtr& cb,
const Ice::Current&)
{
diff --git a/cpp/test/Ice/exceptions/TestAMDI.h b/cpp/test/Ice/exceptions/TestAMDI.h
index be183a000f5..c03de42ed93 100644
--- a/cpp/test/Ice/exceptions/TestAMDI.h
+++ b/cpp/test/Ice/exceptions/TestAMDI.h
@@ -58,6 +58,8 @@ public:
const Ice::Current&);
virtual void throwAssertException_async(const Test::AMD_Thrower_throwAssertExceptionPtr&,
const Ice::Current&);
+ virtual void throwMemoryLimitException_async(const Test::AMD_Thrower_throwMemoryLimitExceptionPtr&,
+ const Ice::ByteSeq&, const Ice::Current&);
virtual void throwLocalExceptionIdempotent_async(const Test::AMD_Thrower_throwLocalExceptionIdempotentPtr&,
const Ice::Current&);
diff --git a/cpp/test/Ice/exceptions/TestI.cpp b/cpp/test/Ice/exceptions/TestI.cpp
index 4ffbece9a6d..d6cd178c0d6 100644
--- a/cpp/test/Ice/exceptions/TestI.cpp
+++ b/cpp/test/Ice/exceptions/TestI.cpp
@@ -152,6 +152,12 @@ ThrowerI::throwAssertException(const Ice::Current&)
assert(false); // Not supported in C++.
}
+Ice::ByteSeq
+ThrowerI::throwMemoryLimitException(const Ice::ByteSeq&, const Ice::Current&)
+{
+ return Ice::ByteSeq(1024 * 20); // 20 KB.
+}
+
void
ThrowerI::throwLocalExceptionIdempotent(const Ice::Current&)
{
diff --git a/cpp/test/Ice/exceptions/TestI.h b/cpp/test/Ice/exceptions/TestI.h
index 8c000801d9c..9417e84b9c5 100644
--- a/cpp/test/Ice/exceptions/TestI.h
+++ b/cpp/test/Ice/exceptions/TestI.h
@@ -40,6 +40,7 @@ public:
virtual void throwLocalException(const Ice::Current&);
virtual void throwNonIceException(const Ice::Current&);
virtual void throwAssertException(const Ice::Current&);
+ virtual Ice::ByteSeq throwMemoryLimitException(const Ice::ByteSeq&, const Ice::Current&);
virtual void throwLocalExceptionIdempotent(const Ice::Current&);