summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Glacier2/SessionRouterI.cpp36
-rw-r--r--cpp/src/Ice/BasicStream.cpp18
-rw-r--r--cpp/src/Ice/ConnectRequestHandler.cpp1
-rw-r--r--cpp/src/Ice/ConnectRequestHandler.h1
-rw-r--r--cpp/src/Ice/ConnectionRequestHandler.cpp4
-rw-r--r--cpp/src/Ice/ConnectionRequestHandler.h1
-rw-r--r--cpp/src/Ice/Incoming.cpp10
-rw-r--r--cpp/src/Ice/Network.cpp10
-rw-r--r--cpp/src/Ice/Object.cpp43
-rw-r--r--cpp/src/Ice/ObjectAdapterI.cpp8
-rw-r--r--cpp/src/Ice/Outgoing.cpp27
-rw-r--r--cpp/src/Ice/OutgoingAsync.cpp20
-rw-r--r--cpp/src/Ice/Proxy.cpp49
-rw-r--r--cpp/src/Ice/RequestHandler.cpp5
-rw-r--r--cpp/src/Ice/RequestHandler.h1
-rw-r--r--cpp/src/Ice/StreamI.cpp6
-rw-r--r--cpp/src/Ice/StreamI.h1
-rwxr-xr-xcpp/src/slice2cpp/Gen.cpp95
-rwxr-xr-xcpp/src/slice2cs/Gen.cpp345
-rw-r--r--cpp/src/slice2java/Gen.cpp223
20 files changed, 545 insertions, 359 deletions
diff --git a/cpp/src/Glacier2/SessionRouterI.cpp b/cpp/src/Glacier2/SessionRouterI.cpp
index 830bb978243..28944c97701 100644
--- a/cpp/src/Glacier2/SessionRouterI.cpp
+++ b/cpp/src/Glacier2/SessionRouterI.cpp
@@ -634,22 +634,30 @@ Glacier2::SessionRouterI::SessionRouterI(const InstancePtr& instance,
Identity routerId;
routerId.category = _instance->properties()->getPropertyWithDefault("Glacier2.InstanceName", "Glacier2");
routerId.name = "router";
- _instance->clientObjectAdapter()->add(this, routerId);
- //
- // All other calls on the client object adapter are dispatched to
- // a router servant based on connection information.
- //
- _instance->clientObjectAdapter()->addServantLocator(new ClientLocator(this), "");
-
- //
- // If there is a server object adapter, all calls on this adapter
- // are dispatched to a router servant based on the category field
- // of the identity.
- //
- if(_instance->serverObjectAdapter())
+ try
+ {
+ _instance->clientObjectAdapter()->add(this, routerId);
+
+ //
+ // All other calls on the client object adapter are dispatched to
+ // a router servant based on connection information.
+ //
+ _instance->clientObjectAdapter()->addServantLocator(new ClientLocator(this), "");
+
+ //
+ // If there is a server object adapter, all calls on this adapter
+ // are dispatched to a router servant based on the category field
+ // of the identity.
+ //
+ if(_instance->serverObjectAdapter())
+ {
+ _instance->serverObjectAdapter()->addServantLocator(new ServerLocator(this), "");
+ }
+ }
+ catch(const Ice::ObjectAdapterDeactivatedException&)
{
- _instance->serverObjectAdapter()->addServantLocator(new ServerLocator(this), "");
+ // Ignore.
}
if(_sessionThread)
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp
index e636c0d952d..6c710bd5ab5 100644
--- a/cpp/src/Ice/BasicStream.cpp
+++ b/cpp/src/Ice/BasicStream.cpp
@@ -291,18 +291,6 @@ IceInternal::BasicStream::ReadEncaps::swap(ReadEncaps& other)
std::swap(previous, other.previous);
}
-void
-IceInternal::BasicStream::checkReadEncaps()
-{
- assert(_currentReadEncaps);
- Container::size_type start = _currentReadEncaps->start;
- Int sz = _currentReadEncaps->sz;
- if(i != b.begin() + start + sz)
- {
- throw EncapsulationException(__FILE__, __LINE__);
- }
-}
-
Int
IceInternal::BasicStream::getReadEncapsSize()
{
@@ -2017,6 +2005,12 @@ IceInternal::BasicStream::throwUnsupportedEncodingException(const char* file, in
}
void
+IceInternal::BasicStream::throwEncapsulationException(const char* file, int line)
+{
+ throw EncapsulationException(file, line);
+}
+
+void
IceInternal::BasicStream::writeInstance(const ObjectPtr& v, Int index)
{
write(index);
diff --git a/cpp/src/Ice/ConnectRequestHandler.cpp b/cpp/src/Ice/ConnectRequestHandler.cpp
index 20d326061dc..d334c1b6c3f 100644
--- a/cpp/src/Ice/ConnectRequestHandler.cpp
+++ b/cpp/src/Ice/ConnectRequestHandler.cpp
@@ -79,7 +79,6 @@ ConnectRequestHandler::ConnectRequestHandler(const ReferencePtr& ref,
RequestHandler(ref),
_proxy(proxy),
_delegate(delegate),
- _response(ref->getMode() == Reference::ModeTwoway),
_batchAutoFlush(
ref->getInstance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.BatchAutoFlush", 1) > 0),
_initialized(false),
diff --git a/cpp/src/Ice/ConnectRequestHandler.h b/cpp/src/Ice/ConnectRequestHandler.h
index b05a33fdfec..a94505003db 100644
--- a/cpp/src/Ice/ConnectRequestHandler.h
+++ b/cpp/src/Ice/ConnectRequestHandler.h
@@ -71,7 +71,6 @@ private:
Ice::ObjectPrx _proxy;
Handle< ::IceDelegate::Ice::Object> _delegate;
- const bool _response;
const bool _batchAutoFlush;
Ice::ConnectionIPtr _connection;
diff --git a/cpp/src/Ice/ConnectionRequestHandler.cpp b/cpp/src/Ice/ConnectionRequestHandler.cpp
index 736e1cdbc0c..35eb67a6c5a 100644
--- a/cpp/src/Ice/ConnectionRequestHandler.cpp
+++ b/cpp/src/Ice/ConnectionRequestHandler.cpp
@@ -19,8 +19,7 @@ using namespace std;
using namespace IceInternal;
ConnectionRequestHandler::ConnectionRequestHandler(const ReferencePtr& reference, const Ice::ObjectPrx& proxy) :
- RequestHandler(reference),
- _response(reference->getMode() == Reference::ModeTwoway)
+ RequestHandler(reference)
{
_connection = _reference->getConnection(_compress);
RouterInfoPtr ri = reference->getRouterInfo();
@@ -34,7 +33,6 @@ ConnectionRequestHandler::ConnectionRequestHandler(const ReferencePtr& reference
const Ice::ConnectionIPtr& connection,
bool compress) :
RequestHandler(reference),
- _response(reference->getMode() == Reference::ModeTwoway),
_connection(connection),
_compress(compress)
{
diff --git a/cpp/src/Ice/ConnectionRequestHandler.h b/cpp/src/Ice/ConnectionRequestHandler.h
index 785cda3b5b6..68daba81e31 100644
--- a/cpp/src/Ice/ConnectionRequestHandler.h
+++ b/cpp/src/Ice/ConnectionRequestHandler.h
@@ -38,7 +38,6 @@ public:
private:
- const bool _response;
Ice::ConnectionIPtr _connection;
bool _compress;
};
diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp
index d7d4bd253b0..cddef9f98e4 100644
--- a/cpp/src/Ice/Incoming.cpp
+++ b/cpp/src/Ice/Incoming.cpp
@@ -296,7 +296,7 @@ IceInternal::Incoming::startOver()
//
// That's the first startOver, so almost nothing to do
//
- _inParamPos = _is.i - 6; // 6 bytes for the start of the encaps
+ _inParamPos = _is.i;
}
else
{
@@ -305,9 +305,7 @@ IceInternal::Incoming::startOver()
//
// Let's rewind _is and clean-up _os
//
- _is.endReadEncaps();
_is.i = _inParamPos;
- _is.startReadEncaps();
if(_response)
{
@@ -384,8 +382,6 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager)
_current.ctx.insert(_current.ctx.end(), pr);
}
- _is.startReadEncaps();
-
if(_response)
{
assert(_os.b.size() == headerSize + 4); // Reply status position.
@@ -508,13 +504,11 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager)
}
catch(const std::exception& ex)
{
- _is.endReadEncaps();
__handleException(ex);
return;
}
catch(...)
{
- _is.endReadEncaps();
__handleException();
return;
}
@@ -524,8 +518,6 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager)
// in the code below are considered fatal, and must propagate to
// the caller of this operation.
//
-
- _is.endReadEncaps();
//
// DispatchAsync is "pseudo dispatch status", used internally only
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp
index 002ea18b780..70940b2e7c3 100644
--- a/cpp/src/Ice/Network.cpp
+++ b/cpp/src/Ice/Network.cpp
@@ -878,6 +878,11 @@ IceInternal::doBind(SOCKET fd, struct sockaddr_storage& addr)
{
size = sizeof(sockaddr_in6);
}
+ else
+ {
+ assert(false);
+ size = 0; // Keep the compiler happy.
+ }
if(bind(fd, reinterpret_cast<struct sockaddr*>(&addr), size) == SOCKET_ERROR)
{
@@ -927,6 +932,11 @@ repeatConnect:
{
size = sizeof(sockaddr_in6);
}
+ else
+ {
+ assert(false);
+ size = 0; // Keep the compiler happy.
+ }
if(::connect(fd, reinterpret_cast<struct sockaddr*>(&addr), size) == SOCKET_ERROR)
{
diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp
index 9c7d05b87f4..7fddcb7f57c 100644
--- a/cpp/src/Ice/Object.cpp
+++ b/cpp/src/Ice/Object.cpp
@@ -95,17 +95,20 @@ DispatchStatus
Ice::Object::___ice_isA(Incoming& __inS, const Current& __current)
{
BasicStream* __is = __inS.is();
- BasicStream* __os = __inS.os();
+ __is->startReadEncaps();
string __id;
__is->read(__id, false);
+ __is->endReadEncaps();
bool __ret = ice_isA(__id, __current);
+ BasicStream* __os = __inS.os();
__os->write(__ret);
return DispatchOK;
}
DispatchStatus
-Ice::Object::___ice_ping(Incoming&, const Current& __current)
+Ice::Object::___ice_ping(Incoming& __inS, const Current& __current)
{
+ __inS.is()->skipEmptyEncaps();
ice_ping(__current);
return DispatchOK;
}
@@ -113,8 +116,9 @@ Ice::Object::___ice_ping(Incoming&, const Current& __current)
DispatchStatus
Ice::Object::___ice_ids(Incoming& __inS, const Current& __current)
{
- BasicStream* __os = __inS.os();
+ __inS.is()->skipEmptyEncaps();
vector<string> __ret = ice_ids(__current);
+ BasicStream* __os = __inS.os();
__os->write(&__ret[0], &__ret[0] + __ret.size(), false);
return DispatchOK;
}
@@ -122,8 +126,9 @@ Ice::Object::___ice_ids(Incoming& __inS, const Current& __current)
DispatchStatus
Ice::Object::___ice_id(Incoming& __inS, const Current& __current)
{
- BasicStream* __os = __inS.os();
+ __inS.is()->skipEmptyEncaps();
string __ret = ice_id(__current);
+ BasicStream* __os = __inS.os();
__os->write(__ret, false);
return DispatchOK;
}
@@ -350,9 +355,12 @@ DispatchStatus
Ice::Blobject::__dispatch(Incoming& in, const Current& current)
{
vector<Byte> inParams;
+ BasicStream* is = in.is();
+ is->startReadEncaps();
+ Int sz = is->getReadEncapsSize();
+ is->readBlob(inParams, sz);
+ is->endReadEncaps();
vector<Byte> outParams;
- Int sz = in.is()->getReadEncapsSize();
- in.is()->readBlob(inParams, sz);
bool ok = ice_invoke(inParams, outParams, current);
in.os()->writeBlob(outParams);
if(ok)
@@ -369,10 +377,13 @@ DispatchStatus
Ice::BlobjectArray::__dispatch(Incoming& in, const Current& current)
{
pair<const Byte*, const Byte*> inParams;
- vector<Byte> outParams;
- Int sz = in.is()->getReadEncapsSize();
- in.is()->readBlob(inParams.first, sz);
+ BasicStream* is = in.is();
+ is->startReadEncaps();
+ Int sz = is->getReadEncapsSize();
+ is->readBlob(inParams.first, sz);
inParams.second = inParams.first + sz;
+ is->endReadEncaps();
+ vector<Byte> outParams;
bool ok = ice_invoke(inParams, outParams, current);
in.os()->writeBlob(outParams);
if(ok)
@@ -389,8 +400,11 @@ DispatchStatus
Ice::BlobjectAsync::__dispatch(Incoming& in, const Current& current)
{
vector<Byte> inParams;
- Int sz = in.is()->getReadEncapsSize();
- in.is()->readBlob(inParams, sz);
+ BasicStream* is = in.is();
+ is->startReadEncaps();
+ Int sz = is->getReadEncapsSize();
+ is->readBlob(inParams, sz);
+ is->endReadEncaps();
AMD_Object_ice_invokePtr cb = new ::IceAsync::Ice::AMD_Object_ice_invoke(in);
try
{
@@ -411,9 +425,12 @@ DispatchStatus
Ice::BlobjectArrayAsync::__dispatch(Incoming& in, const Current& current)
{
pair<const Byte*, const Byte*> inParams;
- Int sz = in.is()->getReadEncapsSize();
- in.is()->readBlob(inParams.first, sz);
+ BasicStream* is = in.is();
+ is->startReadEncaps();
+ Int sz = is->getReadEncapsSize();
+ is->readBlob(inParams.first, sz);
inParams.second = inParams.first + sz;
+ is->endReadEncaps();
AMD_Array_Object_ice_invokePtr cb = new ::IceAsync::Ice::AMD_Array_Object_ice_invoke(in);
try
{
diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp
index dbc65756136..7d6028a75c8 100644
--- a/cpp/src/Ice/ObjectAdapterI.cpp
+++ b/cpp/src/Ice/ObjectAdapterI.cpp
@@ -686,9 +686,13 @@ Ice::ObjectAdapterI::isLocal(const ObjectPrx& proxy) const
{
for(p = endpoints.begin(); p != endpoints.end(); ++p)
{
- if(binary_search(_routerEndpoints.begin(), _routerEndpoints.end(), *p)) // _routerEndpoints is sorted.
+ vector<EndpointIPtr>::const_iterator r;
+ for(r = _routerEndpoints.begin(); r != _routerEndpoints.end(); ++r)
{
- return true;
+ if((*p)->equivalent(*r))
+ {
+ return true;
+ }
}
}
}
diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp
index 24d6263ac2d..8f9b716e52c 100644
--- a/cpp/src/Ice/Outgoing.cpp
+++ b/cpp/src/Ice/Outgoing.cpp
@@ -374,24 +374,12 @@ IceInternal::Outgoing::finished(BasicStream& is)
{
case replyOK:
{
- //
- // Input and output parameters are always sent in an
- // encapsulation, which makes it possible to forward
- // oneway requests as blobs.
- //
- _is.startReadEncaps();
_state = StateOK; // The state must be set last, in case there is an exception.
break;
}
case replyUserException:
{
- //
- // Input and output parameters are always sent in an
- // encapsulation, which makes it possible to forward
- // oneway requests as blobs.
- //
- _is.startReadEncaps();
_state = StateUserException; // The state must be set last, in case there is an exception.
break;
}
@@ -534,6 +522,21 @@ IceInternal::Outgoing::finished(const LocalException& ex)
_monitor.notify();
}
+void
+IceInternal::Outgoing::throwUserException()
+{
+ try
+ {
+ _is.startReadEncaps();
+ _is.throwException();
+ }
+ catch(const Ice::UserException&)
+ {
+ _is.endReadEncaps();
+ throw;
+ }
+}
+
IceInternal::BatchOutgoing::BatchOutgoing(RequestHandler* handler) :
_handler(handler),
_connection(0),
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp
index f215964e4d9..51887688b6a 100644
--- a/cpp/src/Ice/OutgoingAsync.cpp
+++ b/cpp/src/Ice/OutgoingAsync.cpp
@@ -241,7 +241,6 @@ IceInternal::OutgoingAsync::__finished(BasicStream& is)
case replyOK:
case replyUserException:
{
- __is->startReadEncaps();
break;
}
@@ -521,6 +520,21 @@ IceInternal::OutgoingAsync::__send()
}
void
+IceInternal::OutgoingAsync::__throwUserException()
+{
+ try
+ {
+ __is->startReadEncaps();
+ __is->throwException();
+ }
+ catch(const Ice::UserException&)
+ {
+ __is->endReadEncaps();
+ throw;
+ }
+}
+
+void
IceInternal::OutgoingAsync::handleException(const LocalExceptionWrapper& ex)
{
if(_mode == Nonmutating || _mode == Idempotent)
@@ -637,8 +651,10 @@ Ice::AMI_Object_ice_invoke::__response(bool ok) // ok == true means no user exce
vector<Byte> outParams;
try
{
+ __is->startReadEncaps();
Int sz = __is->getReadEncapsSize();
__is->readBlob(outParams, sz);
+ __is->endReadEncaps();
}
catch(const LocalException& ex)
{
@@ -673,9 +689,11 @@ Ice::AMI_Array_Object_ice_invoke::__response(bool ok) // ok == true means no use
pair<const Byte*, const Byte*> outParams;
try
{
+ __is->startReadEncaps();
Int sz = __is->getReadEncapsSize();
__is->readBlob(outParams.first, sz);
outParams.second = outParams.first + sz;
+ __is->endReadEncaps();
}
catch(const LocalException& ex)
{
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp
index 1191532eda2..124ae11f4bb 100644
--- a/cpp/src/Ice/Proxy.cpp
+++ b/cpp/src/Ice/Proxy.cpp
@@ -1170,19 +1170,21 @@ IceDelegateM::Ice::Object::ice_isA(const string& __id, const Context* context)
bool __ok = __og.invoke();
try
{
- BasicStream* __is = __og.is();
if(!__ok)
{
try
{
- __is->throwException();
+ __og.throwUserException();
}
catch(const ::Ice::UserException& __ex)
{
throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
}
}
+ BasicStream* __is = __og.is();
+ __is->startReadEncaps();
__is->read(__ret);
+ __is->endReadEncaps();
}
catch(const ::Ice::LocalException& __ex)
{
@@ -1197,24 +1199,27 @@ IceDelegateM::Ice::Object::ice_ping(const Context* context)
static const string __operation("ice_ping");
Outgoing __og(__handler.get(), __operation, ::Ice::Nonmutating, context);
bool __ok = __og.invoke();
- try
+ if(!__og.is()->b.empty())
{
- BasicStream* __is = __og.is();
- if(!__ok)
+ try
{
- try
- {
- __is->throwException();
- }
- catch(const ::Ice::UserException& __ex)
+ if(!__ok)
{
- throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
+ try
+ {
+ __og.throwUserException();
+ }
+ catch(const ::Ice::UserException& __ex)
+ {
+ throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
+ }
}
+ __og.is()->skipEmptyEncaps();
+ }
+ catch(const ::Ice::LocalException& __ex)
+ {
+ throw ::IceInternal::LocalExceptionWrapper(__ex, false);
}
- }
- catch(const ::Ice::LocalException& __ex)
- {
- throw ::IceInternal::LocalExceptionWrapper(__ex, false);
}
}
@@ -1227,19 +1232,21 @@ IceDelegateM::Ice::Object::ice_ids(const Context* context)
bool __ok = __og.invoke();
try
{
- BasicStream* __is = __og.is();
if(!__ok)
{
try
{
- __is->throwException();
+ __og.throwUserException();
}
catch(const ::Ice::UserException& __ex)
{
throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
}
}
+ BasicStream* __is = __og.is();
+ __is->startReadEncaps();
__is->read(__ret, false);
+ __is->endReadEncaps();
}
catch(const ::Ice::LocalException& __ex)
{
@@ -1257,19 +1264,21 @@ IceDelegateM::Ice::Object::ice_id(const Context* context)
bool __ok = __og.invoke();
try
{
- BasicStream* __is = __og.is();
if(!__ok)
{
try
{
- __is->throwException();
+ __og.throwUserException();
}
catch(const ::Ice::UserException& __ex)
{
throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
}
}
+ BasicStream* __is = __og.is();
+ __is->startReadEncaps();
__is->read(__ret, false);
+ __is->endReadEncaps();
}
catch(const ::Ice::LocalException& __ex)
{
@@ -1301,8 +1310,10 @@ IceDelegateM::Ice::Object::ice_invoke(const string& operation,
try
{
BasicStream* __is = __og.is();
+ __is->startReadEncaps();
Int sz = __is->getReadEncapsSize();
__is->readBlob(outParams, sz);
+ __is->endReadEncaps();
}
catch(const ::Ice::LocalException& __ex)
{
diff --git a/cpp/src/Ice/RequestHandler.cpp b/cpp/src/Ice/RequestHandler.cpp
index cf2845c77ae..f1937fda7f7 100644
--- a/cpp/src/Ice/RequestHandler.cpp
+++ b/cpp/src/Ice/RequestHandler.cpp
@@ -8,6 +8,7 @@
// **********************************************************************
#include <Ice/RequestHandler.h>
+#include <Ice/Reference.h>
using namespace std;
using namespace IceInternal;
@@ -18,6 +19,8 @@ RequestHandler::~RequestHandler()
{
}
-RequestHandler::RequestHandler(const ReferencePtr& reference) : _reference(reference)
+RequestHandler::RequestHandler(const ReferencePtr& reference) :
+ _reference(reference),
+ _response(reference->getMode() == Reference::ModeTwoway)
{
}
diff --git a/cpp/src/Ice/RequestHandler.h b/cpp/src/Ice/RequestHandler.h
index 1b22794930c..7a5b585e0ee 100644
--- a/cpp/src/Ice/RequestHandler.h
+++ b/cpp/src/Ice/RequestHandler.h
@@ -48,6 +48,7 @@ protected:
RequestHandler(const ReferencePtr&);
const ReferencePtr _reference;
+ const bool _response;
};
}
diff --git a/cpp/src/Ice/StreamI.cpp b/cpp/src/Ice/StreamI.cpp
index b0458637dfe..7f2ee26dadf 100644
--- a/cpp/src/Ice/StreamI.cpp
+++ b/cpp/src/Ice/StreamI.cpp
@@ -309,6 +309,12 @@ Ice::InputStreamI::endEncapsulation()
}
void
+Ice::InputStreamI::skipEncapsulation()
+{
+ _is->skipEncaps();
+}
+
+void
Ice::InputStreamI::skipSlice()
{
_is->skipSlice();
diff --git a/cpp/src/Ice/StreamI.h b/cpp/src/Ice/StreamI.h
index 1f00533612d..22c9bd8079d 100644
--- a/cpp/src/Ice/StreamI.h
+++ b/cpp/src/Ice/StreamI.h
@@ -80,6 +80,7 @@ public:
virtual void skipSlice();
virtual void startEncapsulation();
+ virtual void skipEncapsulation();
virtual void endEncapsulation();
virtual void readPendingObjects();
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index bb88118354c..d68c2f4d8c2 100755
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -2622,17 +2622,22 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
C << nl << "__og.abort(__ex);";
C << eb;
}
+
C << nl << "bool __ok = __og.invoke();";
+ if(!p->returnsData())
+ {
+ C << nl << "if(!__og.is()->b.empty())";
+ C << sb;
+ }
C << nl << "try";
C << sb;
- C << nl << "::IceInternal::BasicStream* __is = __og.is();";
C << nl << "if(!__ok)";
C << sb;
C << nl << "try";
C << sb;
- C << nl << "__is->throwException();";
+ C << nl << "__og.throwUserException();";
C << eb;
-
+
//
// Generate a catch block for each legal user exception. This is necessary
// to prevent an "impossible" user exception to be thrown if client and
@@ -2686,11 +2691,23 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
C << nl << fixKwd((*opi)->name()) << " = new " << fixKwd(st->scoped()) << ";";
}
}
- writeUnmarshalCode(C, outParams, ret, p->getMetaData());
- if(p->returnsClasses())
+
+ if(p->returnsData())
+ {
+ C << nl << "::IceInternal::BasicStream* __is = __og.is();";
+ C << nl << "__is->startReadEncaps();";
+ writeUnmarshalCode(C, outParams, ret, p->getMetaData());
+ if(p->returnsClasses())
+ {
+ C << nl << "__is->readPendingObjects();";
+ }
+ C << nl << "__is->endReadEncaps();";
+ }
+ else
{
- C << nl << "__is->readPendingObjects();";
+ C << nl << "__og.is()->skipEmptyEncaps();";
}
+
if(ret)
{
C << nl << "return __ret;";
@@ -2700,6 +2717,10 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
C << sb;
C << nl << "throw ::IceInternal::LocalExceptionWrapper(__ex, false);";
C << eb;
+ if(!p->returnsData())
+ {
+ C << eb;
+ }
C << eb;
}
@@ -3991,11 +4012,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
C << sp;
C << nl << "::Ice::DispatchStatus" << nl << scope.substr(2) << "___" << name
- << "(::IceInternal::Incoming&";
- if(!paramList.empty() || !p->throws().empty() || ret || amd)
- {
- C << "__inS";
- }
+ << "(::IceInternal::Incoming& __inS";
C << ", const ::Ice::Current& __current)" << (isConst ? " const" : "");
C << sb;
if(!amd)
@@ -4022,16 +4039,23 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
if(!inParams.empty())
{
C << nl << "::IceInternal::BasicStream* __is = __inS.is();";
+ C << nl << "__is->startReadEncaps();";
+ writeAllocateCode(C, inParams, 0, StringList(), _useWstring, true);
+ writeUnmarshalCode(C, inParams, 0, StringList(), true);
+ if(p->sendsClasses())
+ {
+ C << nl << "__is->readPendingObjects();";
+ }
+ C << nl << "__is->endReadEncaps();";
}
- if(ret || !outParams.empty() || !throws.empty())
+ else
{
- C << nl << "::IceInternal::BasicStream* __os = __inS.os();";
+ C << nl << "__inS.is()->skipEmptyEncaps();";
}
- writeAllocateCode(C, inParams, 0, StringList(), _useWstring, true);
- writeUnmarshalCode(C, inParams, 0, StringList(), true);
- if(p->sendsClasses())
+
+ if(ret || !outParams.empty() || !throws.empty())
{
- C << nl << "__is->readPendingObjects();";
+ C << nl << "::IceInternal::BasicStream* __os = __inS.os();";
}
writeAllocateCode(C, outParams, 0, StringList(), _useWstring);
if(!throws.empty())
@@ -4063,6 +4087,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
C << eb;
}
}
+
C << nl << "return ::Ice::DispatchOK;";
}
else
@@ -4072,13 +4097,20 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
if(!inParams.empty())
{
C << nl << "::IceInternal::BasicStream* __is = __inS.is();";
+ C << nl << "__is->startReadEncaps();";
+ writeAllocateCode(C, inParams, 0, StringList(), _useWstring, true);
+ writeUnmarshalCode(C, inParams, 0, StringList(), true);
+ if(p->sendsClasses())
+ {
+ C << nl << "__is->readPendingObjects();";
+ }
+ C << nl << "__is->endReadEncaps();";
}
- writeAllocateCode(C, inParams, 0, StringList(), _useWstring, true);
- writeUnmarshalCode(C, inParams, 0, StringList(), true);
- if(p->sendsClasses())
+ else
{
- C << nl << "__is->readPendingObjects();";
+ C << nl << "__inS.is()->skipEmptyEncaps();";
}
+
C << nl << classScopedAMD << '_' << name << "Ptr __cb = new IceAsync" << classScopedAMD << '_' << name
<< "(__inS);";
C << nl << "try";
@@ -5247,7 +5279,7 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
C << sb;
C << nl << "try";
C << sb;
- C << nl << "__is->throwException();";
+ C << nl << "__throwUserException();";
C << eb;
//
// Generate a catch block for each legal user exception.
@@ -5276,14 +5308,23 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
C << nl << "return;";
C << eb;
- writeUnmarshalCode(C, outParams, 0, StringList(), true);
- if(ret)
+ if(p->returnsData())
{
- writeMarshalUnmarshalCode(C, ret, "__ret", false, "", true, p->getMetaData(), true);
+ C << nl << "__is->startReadEncaps();";
+ writeUnmarshalCode(C, outParams, 0, StringList(), true);
+ if(ret)
+ {
+ writeMarshalUnmarshalCode(C, ret, "__ret", false, "", true, p->getMetaData(), true);
+ }
+ if(p->returnsClasses())
+ {
+ C << nl << "__is->readPendingObjects();";
+ }
+ C << nl << "__is->endReadEncaps();";
}
- if(p->returnsClasses())
+ else
{
- C << nl << "__is->readPendingObjects();";
+ C << nl << "__is->skipEmptyEncaps();";
}
C << eb;
C << nl << "catch(const ::Ice::LocalException& __ex)";
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index 3ac77fe0918..6921360f09c 100755
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -305,51 +305,57 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p, bool stream)
_out << nl << "checkMode__(" << sliceModeToIceMode(op->mode()) << ", current__.mode);";
if(!inParams.empty())
{
+ //
+ // Unmarshal 'in' parameters.
+ //
_out << nl << "IceInternal.BasicStream is__ = inS__.istr();";
- }
- if(!outParams.empty() || ret || !throws.empty())
- {
- _out << nl << "IceInternal.BasicStream os__ = inS__.ostr();";
- }
-
- //
- // Unmarshal 'in' parameters.
- //
- for(q = inParams.begin(); q != inParams.end(); ++q)
- {
- string param = fixId(q->second);
- string typeS = typeToString(q->first);
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
- bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
- || ClassDeclPtr::dynamicCast(q->first);
- if(!isClass)
+ _out << nl << "is__.startReadEncaps();";
+ for(q = inParams.begin(); q != inParams.end(); ++q)
{
- _out << nl << typeS << ' ' << param << ';';
- StructPtr st = StructPtr::dynamicCast(q->first);
- if(st)
+ string param = fixId(q->second);
+ string typeS = typeToString(q->first);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
+ bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
+ || ClassDeclPtr::dynamicCast(q->first);
+ if(!isClass)
{
- if(isValueType(q->first))
+ _out << nl << typeS << ' ' << param << ';';
+ StructPtr st = StructPtr::dynamicCast(q->first);
+ if(st)
{
- _out << nl << param << " = new " << typeS << "();";
- }
- else
- {
- _out << nl << param << " = null;";
+ if(isValueType(q->first))
+ {
+ _out << nl << param << " = new " << typeS << "();";
+ }
+ else
+ {
+ _out << nl << param << " = null;";
+ }
}
}
+ writeMarshalUnmarshalCode(_out, q->first, param, false, false, true);
+ }
+ if(op->sendsClasses())
+ {
+ _out << nl << "is__.readPendingObjects();";
}
- writeMarshalUnmarshalCode(_out, q->first, param, false, false, true);
+ _out << nl << "is__.endReadEncaps();";
}
- if(op->sendsClasses())
+ else
{
- _out << nl << "is__.readPendingObjects();";
+ _out << nl << "inS__.istr().skipEmptyEncaps();";
}
-
+
for(q = outParams.begin(); q != outParams.end(); ++q)
{
string typeS = typeToString(q->first);
_out << nl << typeS << ' ' << fixId(q->second) << ";";
}
+
+ if(!outParams.empty() || ret || !throws.empty())
+ {
+ _out << nl << "IceInternal.BasicStream os__ = inS__.ostr();";
+ }
//
// Call on the servant.
@@ -444,42 +450,47 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p, bool stream)
if(!inParams.empty())
{
+ //
+ // Unmarshal 'in' parameters.
+ //
_out << nl << "IceInternal.BasicStream is__ = inS__.istr();";
- }
-
- //
- // Unmarshal 'in' parameters.
- //
- for(q = inParams.begin(); q != inParams.end(); ++q)
- {
- string param = fixId(q->second);
- string typeS = typeToString(q->first);
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
- bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
- || ClassDeclPtr::dynamicCast(q->first);
- if(!isClass)
+ _out << nl << "is__.startReadEncaps();";
+ for(q = inParams.begin(); q != inParams.end(); ++q)
{
- _out << nl << typeS << ' ' << param << ';';
- StructPtr st = StructPtr::dynamicCast(q->first);
- if(st)
+ string param = fixId(q->second);
+ string typeS = typeToString(q->first);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
+ bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
+ || ClassDeclPtr::dynamicCast(q->first);
+ if(!isClass)
{
- if(isValueType(q->first))
- {
- _out << nl << param << " = new " << typeS << "();";
- }
- else
+ _out << nl << typeS << ' ' << param << ';';
+ StructPtr st = StructPtr::dynamicCast(q->first);
+ if(st)
{
- _out << nl << param << " = null;";
+ if(isValueType(q->first))
+ {
+ _out << nl << param << " = new " << typeS << "();";
+ }
+ else
+ {
+ _out << nl << param << " = null;";
+ }
}
}
+ writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true);
}
- writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true);
+ if(op->sendsClasses())
+ {
+ _out << nl << "is__.readPendingObjects();";
+ }
+ _out << nl << "is__.endReadEncaps();";
}
- if(op->sendsClasses())
+ else
{
- _out << nl << "is__.readPendingObjects();";
+ _out << nl << "inS__.istr().skipEmptyEncaps();";
}
-
+
//
// Call on the servant.
//
@@ -3856,9 +3867,13 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << eb;
}
_out << nl << "bool ok__ = og__.invoke();";
+ if(!op->returnsData())
+ {
+ _out << nl << "if(!og__.istr().isEmpty())";
+ _out << sb;
+ }
_out << nl << "try";
_out << sb;
- _out << nl << "IceInternal.BasicStream is__ = og__.istr();";
_out << nl << "if(!ok__)";
_out << sb;
//
@@ -3867,7 +3882,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
//
_out << nl << "try";
_out << sb;
- _out << nl << "is__.throwException();";
+ _out << nl << "og__.throwUserException();";
_out << eb;
for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
{
@@ -3881,76 +3896,87 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "throw new Ice.UnknownUserException(ex.ice_name(), ex);";
_out << eb;
_out << eb;
- for(q = outParams.begin(); q != outParams.end(); ++q)
+ if(op->returnsData())
{
- string param = fixId(q->second);
- StructPtr st = StructPtr::dynamicCast(q->first);
- if(st)
+ _out << nl << "IceInternal.BasicStream is__ = og__.istr();";
+ _out << nl << "is__.startReadEncaps();";
+ for(q = outParams.begin(); q != outParams.end(); ++q)
+ {
+ string param = fixId(q->second);
+ StructPtr st = StructPtr::dynamicCast(q->first);
+ if(st)
+ {
+ if(isValueType(q->first))
+ {
+ _out << nl << param << " = new " << typeToString(q->first) << "();";
+ }
+ else
+ {
+ _out << nl << param << " = null;";
+ }
+ }
+ writeMarshalUnmarshalCode(_out, q->first, param, false, false, true, "");
+ }
+ if(ret)
{
- if(isValueType(q->first))
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
{
- _out << nl << param << " = new " << typeToString(q->first) << "();";
+ _out << nl << retS << " ret__;";
+ ContainedPtr contained = ContainedPtr::dynamicCast(ret);
+ string sliceId = contained ? contained->scoped() : "::Ice::Object";
+ _out << nl << "IceInternal.ParamPatcher<" << retS << "> ret___PP = new IceInternal.ParamPatcher<"
+ << retS << ">(\"" << sliceId << "\");";
+ _out << nl << "is__.readObject(ret___PP);";
}
else
{
- _out << nl << param << " = null;";
+ _out << nl << retS << " ret__;";
+ StructPtr st = StructPtr::dynamicCast(ret);
+ if(st)
+ {
+ if(isValueType(st))
+ {
+ _out << nl << "ret__ = new " << retS << "();";
+ }
+ else
+ {
+ _out << nl << "ret__ = null;";
+ }
+ }
+ writeMarshalUnmarshalCode(_out, ret, "ret__", false, false, true, "");
}
}
- writeMarshalUnmarshalCode(_out, q->first, param, false, false, true, "");
- }
- if(ret)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
- {
- _out << nl << retS << " ret__;";
- ContainedPtr contained = ContainedPtr::dynamicCast(ret);
- string sliceId = contained ? contained->scoped() : "::Ice::Object";
- _out << nl << "IceInternal.ParamPatcher<" << retS << "> ret___PP = new IceInternal.ParamPatcher<"
- << retS << ">(\"" << sliceId << "\");";
- _out << nl << "is__.readObject(ret___PP);";
- }
- else
+ if(op->returnsClasses())
{
- _out << nl << retS << " ret__;";
- StructPtr st = StructPtr::dynamicCast(ret);
- if(st)
+ _out << nl << "is__.readPendingObjects();";
+ for(q = outParams.begin(); q != outParams.end(); ++q)
{
- if(isValueType(st))
- {
- _out << nl << "ret__ = new " << retS << "();";
- }
- else
- {
- _out << nl << "ret__ = null;";
+ string param = fixId(q->second);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->first))
+ {
+ string type = typeToString(q->first);
+ _out << nl << "try";
+ _out << sb;
+ _out << nl << param << " = (" << type << ")" << param << "_PP.value;";
+ _out << eb;
+ _out << nl << "catch(System.InvalidCastException)";
+ _out << sb;
+ _out << nl << param << " = null;";
+ _out << nl << "IceInternal.Ex.throwUOE(" << param << "_PP.type(), "
+ << param << "_PP.value.ice_id());";
+ _out << eb;
}
}
- writeMarshalUnmarshalCode(_out, ret, "ret__", false, false, true, "");
}
+ _out << nl << "is__.endReadEncaps();";
}
- if(op->returnsClasses())
+ else
{
- _out << nl << "is__.readPendingObjects();";
- for(q = outParams.begin(); q != outParams.end(); ++q)
- {
- string param = fixId(q->second);
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->first))
- {
- string type = typeToString(q->first);
- _out << nl << "try";
- _out << sb;
- _out << nl << param << " = (" << type << ")" << param << "_PP.value;";
- _out << eb;
- _out << nl << "catch(System.InvalidCastException)";
- _out << sb;
- _out << nl << param << " = null;";
- _out << nl << "IceInternal.Ex.throwUOE(" << param << "_PP.type(), "
- << param << "_PP.value.ice_id());";
- _out << eb;
- }
- }
+ _out << nl << "og__.istr().skipEmptyEncaps();";
}
+
if(ret)
{
BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
@@ -3973,6 +3999,10 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sb;
_out << nl << "throw new IceInternal.LocalExceptionWrapper(ex__, false);";
_out << eb;
+ if(!op->returnsData())
+ {
+ _out << eb;
+ }
_out << eb;
_out << nl << "finally";
_out << sb;
@@ -4450,7 +4480,7 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
_out << sb;
_out << nl << "try";
_out << sb;
- _out << nl << "is__.throwException();";
+ _out << nl << "throwUserException__();";
_out << eb;
for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r)
{
@@ -4465,59 +4495,68 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
_out << eb;
_out << "return;";
_out << eb;
- for(q = outParams.begin(); q != outParams.end(); ++q)
+ if(p->returnsData())
{
- string param = fixId(q->second);
- StructPtr st = StructPtr::dynamicCast(q->first);
- if(st)
- if(isValueType(st))
- {
- _out << nl << param << " = new " << typeToString(q->first) << "();";
- }
- else
+ _out << nl << "is__.startReadEncaps();";
+ for(q = outParams.begin(); q != outParams.end(); ++q)
{
- _out << nl << param << " = null;";
+ string param = fixId(q->second);
+ StructPtr st = StructPtr::dynamicCast(q->first);
+ if(st)
+ if(isValueType(st))
+ {
+ _out << nl << param << " = new " << typeToString(q->first) << "();";
+ }
+ else
+ {
+ _out << nl << param << " = null;";
+ }
+ writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true);
}
- writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true);
- }
- if(ret)
- {
- StructPtr st = StructPtr::dynamicCast(ret);
- if(st)
+ if(ret)
{
- if(isValueType(ret))
+ StructPtr st = StructPtr::dynamicCast(ret);
+ if(st)
{
- _out << nl << "ret__ = new " << retS << "();";
+ if(isValueType(ret))
+ {
+ _out << nl << "ret__ = new " << retS << "();";
+ }
+ else
+ {
+ _out << nl << "ret__ = null;";
+ }
}
- else
+ writeMarshalUnmarshalCode(_out, ret, "ret__", false, false, true);
+ }
+ if(p->returnsClasses())
+ {
+ _out << nl << "is__.readPendingObjects();";
+ }
+ _out << nl << "is__.endReadEncaps();";
+ for(q = outParams.begin(); q != outParams.end(); ++q)
+ {
+ string param = fixId(q->second);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->first))
{
- _out << nl << "ret__ = null;";
+ string type = typeToString(q->first);
+ _out << nl << param << " = (" << type << ")" << param << "_PP.value;";
}
}
- writeMarshalUnmarshalCode(_out, ret, "ret__", false, false, true);
- }
- if(p->returnsClasses())
- {
- _out << nl << "is__.readPendingObjects();";
- }
- for(q = outParams.begin(); q != outParams.end(); ++q)
- {
- string param = fixId(q->second);
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->first))
+ if(ret)
{
- string type = typeToString(q->first);
- _out << nl << param << " = (" << type << ")" << param << "_PP.value;";
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
+ {
+ string type = typeToString(ret);
+ _out << nl << "ret__ = (" << retS << ")ret___PP.value;";
+ }
}
}
- if(ret)
+ else
{
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
- {
- string type = typeToString(ret);
- _out << nl << "ret__ = (" << retS << ")ret___PP.value;";
- }
+ _out << nl << "is__.skipEmptyEncaps();";
}
_out << eb;
_out << nl << "catch(Ice.LocalException ex__)";
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 6990c90618c..ddf80905a61 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -634,41 +634,42 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
if(!inParams.empty())
{
+ //
+ // Unmarshal 'in' parameters.
+ //
out << nl << "IceInternal.BasicStream __is = __inS.is();";
- }
- if(!outParams.empty() || ret || !throws.empty())
- {
- out << nl << "IceInternal.BasicStream __os = __inS.os();";
- }
-
- //
- // Unmarshal 'in' parameters.
- //
- iter = 0;
- for(pli = inParams.begin(); pli != inParams.end(); ++pli)
- {
- StringList metaData = (*pli)->getMetaData();
- TypePtr paramType = (*pli)->type();
- string paramName = fixKwd((*pli)->name());
- string typeS = typeToString(paramType, TypeModeIn, package, metaData);
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ out << nl << "__is.startReadEncaps();";
+ iter = 0;
+ for(pli = inParams.begin(); pli != inParams.end(); ++pli)
{
- out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();";
- writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, true,
- metaData, string());
+ StringList metaData = (*pli)->getMetaData();
+ TypePtr paramType = (*pli)->type();
+ string paramName = fixKwd((*pli)->name());
+ string typeS = typeToString(paramType, TypeModeIn, package, metaData);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ {
+ out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();";
+ writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, true,
+ metaData, string());
+ }
+ else
+ {
+ out << nl << typeS << ' ' << paramName << ';';
+ writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, false, metaData);
+ }
}
- else
+ if(op->sendsClasses())
{
- out << nl << typeS << ' ' << paramName << ';';
- writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, false, metaData);
+ out << nl << "__is.readPendingObjects();";
}
+ out << nl << "__is.endReadEncaps();";
}
- if(op->sendsClasses())
+ else
{
- out << nl << "__is.readPendingObjects();";
+ out << nl << "__inS.is().skipEmptyEncaps();";
}
-
+
//
// Create holders for 'out' parameters.
//
@@ -678,6 +679,11 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
out << nl << typeS << ' ' << fixKwd((*pli)->name()) << " = new " << typeS << "();";
}
+ if(!outParams.empty() || ret || !throws.empty())
+ {
+ out << nl << "IceInternal.BasicStream __os = __inS.os();";
+ }
+
//
// Call on the servant.
//
@@ -764,40 +770,45 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
int iter;
out << nl << "__checkMode(" << sliceModeToIceMode(op->mode()) << ", __current.mode);";
-
+
if(!inParams.empty())
{
+ //
+ // Unmarshal 'in' parameters.
+ //
out << nl << "IceInternal.BasicStream __is = __inS.is();";
- }
-
- //
- // Unmarshal 'in' parameters.
- //
- iter = 0;
- for(pli = inParams.begin(); pli != inParams.end(); ++pli)
- {
- StringList metaData = (*pli)->getMetaData();
- TypePtr paramType = (*pli)->type();
- string paramName = fixKwd((*pli)->name());
- string typeS = typeToString(paramType, TypeModeIn, package, metaData);
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ out << nl << "__is.startReadEncaps();";
+ iter = 0;
+ for(pli = inParams.begin(); pli != inParams.end(); ++pli)
{
- out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();";
- writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, true, metaData,
- string());
+ StringList metaData = (*pli)->getMetaData();
+ TypePtr paramType = (*pli)->type();
+ string paramName = fixKwd((*pli)->name());
+ string typeS = typeToString(paramType, TypeModeIn, package, metaData);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ {
+ out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();";
+ writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, true, metaData,
+ string());
+ }
+ else
+ {
+ out << nl << typeS << ' ' << paramName << ';';
+ writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, false, metaData);
+ }
}
- else
+ if(op->sendsClasses())
{
- out << nl << typeS << ' ' << paramName << ';';
- writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, false, metaData);
+ out << nl << "__is.readPendingObjects();";
}
+ out << nl << "__is.endReadEncaps();";
}
- if(op->sendsClasses())
+ else
{
- out << nl << "__is.readPendingObjects();";
+ out << nl << "__inS.is().skipEmptyEncaps();";
}
-
+
//
// Call on the servant.
//
@@ -4225,15 +4236,21 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "__og.abort(__ex);";
out << eb;
}
+
out << nl << "boolean __ok = __og.invoke();";
+ if(!op->returnsData())
+ {
+ out << nl << "if(!__og.is().isEmpty())";
+ out << sb;
+ }
+
out << nl << "try";
out << sb;
- out << nl << "IceInternal.BasicStream __is = __og.is();";
out << nl << "if(!__ok)";
out << sb;
out << nl << "try";
out << sb;
- out << nl << "__is.throwException();";
+ out << nl << "__og.throwUserException();";
out << eb;
for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
{
@@ -4247,29 +4264,40 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "throw new Ice.UnknownUserException(__ex.ice_name());";
out << eb;
out << eb;
- for(pli = outParams.begin(); pli != outParams.end(); ++pli)
- {
- writeMarshalUnmarshalCode(out, package, (*pli)->type(), fixKwd((*pli)->name()), false, iter, true,
- (*pli)->getMetaData());
- }
- if(ret)
+ if(op->returnsData())
{
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
+ out << nl << "IceInternal.BasicStream __is = __og.is();";
+ out << nl << "__is.startReadEncaps();";
+ for(pli = outParams.begin(); pli != outParams.end(); ++pli)
{
- out << nl << retS << "Holder __ret = new " << retS << "Holder();";
- out << nl << "__is.readObject(__ret.getPatcher());";
+ writeMarshalUnmarshalCode(out, package, (*pli)->type(), fixKwd((*pli)->name()), false, iter, true,
+ (*pli)->getMetaData());
}
- else
+ if(ret)
{
- out << nl << retS << " __ret;";
- writeMarshalUnmarshalCode(out, package, ret, "__ret", false, iter, false, opMetaData);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
+ {
+ out << nl << retS << "Holder __ret = new " << retS << "Holder();";
+ out << nl << "__is.readObject(__ret.getPatcher());";
+ }
+ else
+ {
+ out << nl << retS << " __ret;";
+ writeMarshalUnmarshalCode(out, package, ret, "__ret", false, iter, false, opMetaData);
+ }
+ }
+ if(op->returnsClasses())
+ {
+ out << nl << "__is.readPendingObjects();";
}
+ out << nl << "__is.endReadEncaps();";
}
- if(op->returnsClasses())
+ else
{
- out << nl << "__is.readPendingObjects();";
+ out << nl << "__og.is().skipEmptyEncaps();";
}
+
if(ret)
{
BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
@@ -4287,6 +4315,11 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sb;
out << nl << "throw new IceInternal.LocalExceptionWrapper(__ex, false);";
out << eb;
+ if(!op->returnsData())
+ {
+ out << eb;
+ }
+
out << eb;
out << nl << "finally";
out << sb;
@@ -5096,7 +5129,7 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
out << sb;
out << nl << "try";
out << sb;
- out << nl << "__is.throwException();";
+ out << nl << "__throwUserException();";
out << eb;
for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r)
{
@@ -5110,38 +5143,48 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
out << nl << "throw new Ice.UnknownUserException(__ex.ice_name());";
out << eb;
out << eb;
- for(pli = outParams.begin(); pli != outParams.end(); ++pli)
+ if(p->returnsData())
{
- TypePtr paramType = (*pli)->type();
- string paramName = fixKwd((*pli)->name());
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
- {
- out << nl << "__is.readObject(" << paramName << ".getPatcher());";
- }
- else
+ out << nl << "__is.startReadEncaps();";
+ for(pli = outParams.begin(); pli != outParams.end(); ++pli)
{
- writeMarshalUnmarshalCode(out, classPkg, paramType, paramName, false, iter, false,
- (*pli)->getMetaData());
+ TypePtr paramType = (*pli)->type();
+ string paramName = fixKwd((*pli)->name());
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ {
+ out << nl << "__is.readObject(" << paramName << ".getPatcher());";
+ }
+ else
+ {
+ writeMarshalUnmarshalCode(out, classPkg, paramType, paramName, false, iter, false,
+ (*pli)->getMetaData());
+ }
}
- }
- if(ret)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
+ if(ret)
{
- out << nl << "__is.readObject(__ret.getPatcher());";
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
+ {
+ out << nl << "__is.readObject(__ret.getPatcher());";
+ }
+ else
+ {
+ writeMarshalUnmarshalCode(out, classPkg, ret, "__ret", false, iter, false, opMetaData);
+ }
}
- else
+ if(p->returnsClasses())
{
- writeMarshalUnmarshalCode(out, classPkg, ret, "__ret", false, iter, false, opMetaData);
+ out << nl << "__is.readPendingObjects();";
}
+ out << nl << "__is.endReadEncaps();";
}
- if(p->returnsClasses())
+ else
{
- out << nl << "__is.readPendingObjects();";
+ out << nl << "__is.skipEmptyEncaps();";
}
out << eb;
+
if(!throws.empty())
{
out << nl << "catch(Ice.UserException __ex)";