[hydra-commits] beagles: branch ice/slice-preserving-translators r612 - in /ice/branches/slic...

SVN commits to the Hydra project hydra-commits at lists.digium.com
Wed May 5 09:48:57 CDT 2010


Author: beagles
Date: Wed May  5 09:48:57 2010
New Revision: 612

URL: https://origsvn.digium.com/svn-view/hydra?view=rev&rev=612
Log:
First pass through supporting encapsulated objects in preserving exceptions

Added:
    ice/branches/slice-preserving-translators/cpp/include/Ice/SliceHolder.h   (with props)
    ice/branches/slice-preserving-translators/cpp/src/Ice/SliceHolder.cpp   (with props)
Modified:
    ice/branches/slice-preserving-translators/cpp/include/Ice/BasicStream.h
    ice/branches/slice-preserving-translators/cpp/include/Ice/Exception.h
    ice/branches/slice-preserving-translators/cpp/src/Ice/BasicStream.cpp
    ice/branches/slice-preserving-translators/cpp/src/Ice/Makefile
    ice/branches/slice-preserving-translators/cpp/src/Ice/Makefile.mak
    ice/branches/slice-preserving-translators/cpp/src/slice2cpp/Gen.cpp
    ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/AllTests.cpp
    ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/ClientPrivate.ice
    ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/Test.ice
    ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/TestI.cpp
    ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/TestI.h
    ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/AllTests.cpp
    ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/ClientPrivate.ice
    ice/branches/slice-preserving-translators/cs/src/Ice/BasicStream.cs
    ice/branches/slice-preserving-translators/java/src/IceInternal/BasicStream.java

Modified: ice/branches/slice-preserving-translators/cpp/include/Ice/BasicStream.h
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/include/Ice/BasicStream.h?view=diff&rev=612&r1=611&r2=612
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/include/Ice/BasicStream.h (original)
+++ ice/branches/slice-preserving-translators/cpp/include/Ice/BasicStream.h Wed May  5 09:48:57 2010
@@ -16,6 +16,7 @@
 #include <Ice/ObjectFactoryF.h>
 #include <Ice/Buffer.h>
 #include <Ice/Protocol.h>
+#include <Ice/SliceHolder.h>
 
 namespace Ice
 {
@@ -34,12 +35,6 @@
 
 namespace IceInternal
 {
-
-struct SkippedSlice
-{
-    std::string typeId;
-    std::vector< ::Ice::Byte > slice;
-};
 
 class ICE_API BasicStream : public Buffer
 {
@@ -312,7 +307,7 @@
     void writeBlob(const std::vector<Ice::Byte>&);
     void readBlob(std::vector<Ice::Byte>&, Ice::Int);
 
-    void getSkippedSlices(std::vector<SkippedSlice>&);
+    void getSkippedSlices(std::vector<Ice::SkippedSlice>&);
 
     void writeBlob(const Ice::Byte* v, Container::size_type sz)
     {
@@ -663,11 +658,14 @@
 
     Container::iterator _currentObjectStart;
 
-    std::vector<SkippedSlice> _skippedSlices;
+    std::vector<Ice::SkippedSlice> _skippedSlices;
 
     void writeInstance(const Ice::ObjectPtr&, Ice::Int);
     void patchPointers(Ice::Int, IndexToPtrMap::const_iterator, PatchMap::iterator);
 
+    void getSlicedObjects(std::vector<Ice::SlicedObject>&);
+    void writeSlicedObjects(const Ice::SlicedObjectsHolder*);
+
     int _traceSlicing;
     const char* _slicingCat;
 

Modified: ice/branches/slice-preserving-translators/cpp/include/Ice/Exception.h
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/include/Ice/Exception.h?view=diff&rev=612&r1=611&r2=612
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/include/Ice/Exception.h (original)
+++ ice/branches/slice-preserving-translators/cpp/include/Ice/Exception.h Wed May  5 09:48:57 2010
@@ -44,7 +44,6 @@
     virtual Exception* ice_clone() const = 0;
     virtual void ice_throw() const = 0;
 };
-
 
 class ICE_API UserException : public IceUtil::Exception
 {

Added: ice/branches/slice-preserving-translators/cpp/include/Ice/SliceHolder.h
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/include/Ice/SliceHolder.h?view=auto&rev=612
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/include/Ice/SliceHolder.h (added)
+++ ice/branches/slice-preserving-translators/cpp/include/Ice/SliceHolder.h Wed May  5 09:48:57 2010
@@ -1,0 +1,37 @@
+#ifndef ICE_SLICE_HOLDER_H
+#define ICE_SLICE_HOLDER_H
+
+#include <Ice/Config.h>
+#include <vector>
+#include <string>
+
+namespace Ice
+{
+    
+struct SkippedSlice
+{
+    std::string typeId;
+    std::vector< ::Ice::Byte > slice;
+};
+
+struct SlicedObject
+{
+    Int id;
+    std::vector<SkippedSlice> slices;
+};
+
+class ICE_API SlicedObjectsHolder
+{
+public:
+    virtual ~SlicedObjectsHolder() {}
+
+    virtual void store(std::vector<SlicedObject>&);
+    virtual const std::vector<SlicedObject>& get() const;
+
+protected:
+    std::vector<SlicedObject> _extra;
+};
+
+}
+
+#endif

Propchange: ice/branches/slice-preserving-translators/cpp/include/Ice/SliceHolder.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ice/branches/slice-preserving-translators/cpp/include/Ice/SliceHolder.h
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: ice/branches/slice-preserving-translators/cpp/include/Ice/SliceHolder.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ice/branches/slice-preserving-translators/cpp/src/Ice/BasicStream.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/src/Ice/BasicStream.cpp?view=diff&rev=612&r1=611&r2=612
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/src/Ice/BasicStream.cpp (original)
+++ ice/branches/slice-preserving-translators/cpp/src/Ice/BasicStream.cpp Wed May  5 09:48:57 2010
@@ -1938,11 +1938,26 @@
 void
 IceInternal::BasicStream::write(const UserException& v)
 {
-    write(v.__usesClasses());
-    v.__write(this);
     if(v.__usesClasses())
     {
+	write(v.__usesClasses());
+	v.__write(this);
         writePendingObjects();
+    }
+    else
+    {
+        const SlicedObjectsHolder* h = dynamic_cast<const SlicedObjectsHolder*>(&v);
+        if(h)
+	{
+	    write(true);
+	    v.__write(this);
+	    writeSlicedObjects(h);
+	}
+	else
+	{
+	    write(false);
+	    v.__write(this);
+	}
     }
 }
 
@@ -1979,9 +1994,29 @@
             catch(UserException& ex)
             {
                 ex.__read(this, false);
+                
                 if(usesClasses)
                 {
-                    readPendingObjects();
+                    if(ex.__usesClasses())
+                    {
+                        readPendingObjects();
+                    }
+                    else
+                    {
+                        //
+                        // At this point, the exception on the wire has enclosed objects but the type that is being
+                        // thrown doesn't. We need to capture the rest of the data, but care needs to be taken not to break
+                        // the encapsulation. We can't do use readPendingObjects because it will attempt to locate factories
+                        // and instantiate the pieces but there cannot be an ownership relationship.
+                        //
+                        SlicedObjectsHolder* h = dynamic_cast<SlicedObjectsHolder*>(&ex);
+                        if(h)
+                        {
+                            vector<SlicedObject> slicedObjects;
+                            getSlicedObjects(slicedObjects);
+                            h->store(slicedObjects);
+                        }
+                    }
                 }
                 ex.ice_throw();
             }
@@ -2231,3 +2266,92 @@
     _currentReadEncaps->patchMap->erase(patchPos);
 }
 
+void
+IceInternal::BasicStream::getSlicedObjects(vector<SlicedObject>& objs)
+{
+    Int num  = 1;
+    if(b.end() - i < 1)
+    {
+        return;
+    }
+    readSize(num);
+
+    if(num > 0)
+    {
+	if(!_currentReadEncaps) // Lazy initialization.
+	{
+	    _currentReadEncaps = &_preAllocatedReadEncaps;
+	}
+
+	if(!_currentReadEncaps->patchMap) // Lazy initialization.
+	{
+	    _currentReadEncaps->patchMap = new PatchMap;
+	    _currentReadEncaps->unmarshaledMap = new IndexToPtrMap;
+	    _currentReadEncaps->typeIdMap = new TypeIdReadMap;
+	}
+    }
+
+    while(num > 0)
+    {
+	for(Int n = 0; n < num; ++n)
+	{
+	    SlicedObject obj;
+	    Int id;
+	    read(id);
+	    obj.id = id;
+
+	    string typeId;
+	    readTypeId(typeId);
+	    _currentObjectStart = i;
+	    while(true)
+	    {
+		if(typeId == Ice::Object::ice_staticId())
+		{
+		    // Last slice!
+		    skipSlice(typeId);
+		    break;
+		}
+		skipSlice(typeId);
+		readTypeId(typeId);
+		_currentObjectStart = i;
+	    }
+	    getSkippedSlices(obj.slices);
+	    objs.push_back(obj);
+	}
+	readSize(num);
+    }
+}
+
+void
+IceInternal::BasicStream::writeSlicedObjects(const SlicedObjectsHolder* holder)
+{
+    if(!_currentWriteEncaps) // Lazy initialization.
+    {
+	_currentWriteEncaps = &_preAllocatedWriteEncaps;
+	_currentWriteEncaps->start = b.size();
+    }
+
+    if(!_currentWriteEncaps->toBeMarshaledMap) // Lazy initialization.
+    {
+	_currentWriteEncaps->toBeMarshaledMap = new PtrToIndexMap;
+	_currentWriteEncaps->marshaledMap = new PtrToIndexMap;
+	_currentWriteEncaps->typeIdMap = new TypeIdWriteMap;
+    }
+
+    vector<SlicedObject> held(holder->get());
+    Int currentSize = static_cast<Int>(held.size());
+    if(held.size() > 0)
+    {
+	writeSize(currentSize);
+    }
+    for(vector<SlicedObject>::const_iterator i = held.begin(); i != held.end(); ++i)
+    {
+	write(i->id);
+	for(vector<SkippedSlice>::const_iterator j = i->slices.begin(); j != i->slices.end(); ++j)
+	{
+	    writeTypeId(j->typeId);
+	    writeBlob(j->slice);
+	}
+    }
+    writeSize(0);
+}

Modified: ice/branches/slice-preserving-translators/cpp/src/Ice/Makefile
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/src/Ice/Makefile?view=diff&rev=612&r1=611&r2=612
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/src/Ice/Makefile (original)
+++ ice/branches/slice-preserving-translators/cpp/src/Ice/Makefile Wed May  5 09:48:57 2010
@@ -20,6 +20,7 @@
                   Base64.o \
 		  Buffer.o \
 		  BasicStream.o \
+		  SliceHolder.o \
 		  BuiltinSequences.o \
 		  CommunicatorI.o \
 		  Communicator.o \

Modified: ice/branches/slice-preserving-translators/cpp/src/Ice/Makefile.mak
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/src/Ice/Makefile.mak?view=diff&rev=612&r1=611&r2=612
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/src/Ice/Makefile.mak (original)
+++ ice/branches/slice-preserving-translators/cpp/src/Ice/Makefile.mak Wed May  5 09:48:57 2010
@@ -19,6 +19,7 @@
                   Base64.obj \
 		  Buffer.obj \
 		  BasicStream.obj \
+		  SliceHolder.obj \
 		  BuiltinSequences.obj \
 		  CommunicatorI.obj \
 		  Communicator.obj \

Added: ice/branches/slice-preserving-translators/cpp/src/Ice/SliceHolder.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/src/Ice/SliceHolder.cpp?view=auto&rev=612
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/src/Ice/SliceHolder.cpp (added)
+++ ice/branches/slice-preserving-translators/cpp/src/Ice/SliceHolder.cpp Wed May  5 09:48:57 2010
@@ -1,0 +1,13 @@
+#include <Ice/SliceHolder.h>
+
+void
+Ice::SlicedObjectsHolder::store(std::vector<Ice::SlicedObject>& extra)
+{
+    _extra.swap(extra);
+}
+
+const std::vector<Ice::SlicedObject>&
+Ice::SlicedObjectsHolder::get() const
+{
+    return _extra;
+}

Propchange: ice/branches/slice-preserving-translators/cpp/src/Ice/SliceHolder.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ice/branches/slice-preserving-translators/cpp/src/Ice/SliceHolder.cpp
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: ice/branches/slice-preserving-translators/cpp/src/Ice/SliceHolder.cpp
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ice/branches/slice-preserving-translators/cpp/src/slice2cpp/Gen.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/src/slice2cpp/Gen.cpp?view=diff&rev=612&r1=611&r2=612
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/src/slice2cpp/Gen.cpp (original)
+++ ice/branches/slice-preserving-translators/cpp/src/slice2cpp/Gen.cpp Wed May  5 09:48:57 2010
@@ -292,6 +292,7 @@
     H << "\n#include <Ice/ObjectF.h>";
     H << "\n#include <Ice/Exception.h>";
     H << "\n#include <Ice/LocalObject.h>";
+    H << "\n#include <Ice/SliceHolder.h>";
 
     if(p->usesProxies())
     {
@@ -622,6 +623,15 @@
         }
     }
 
+    std::string dummy;
+    bool preserving = scanParentsMetaData(p, preserveTag, dummy);
+    bool switchWrites = false;
+    if(!preserving)
+    {
+        switchWrites = p->findMetaData(preserveTag, dummy);
+        preserving = switchWrites;
+    }
+    
     H << sp << nl << "class " << _dllExport << name << " : ";
     H.useCurrentPosAsIndent();
     H << "public ";
@@ -632,6 +642,10 @@
     else
     {
         H << fixKwd(base->scoped());
+    }
+    if(switchWrites)
+    {
+        H << ", public ::Ice::SlicedObjectsHolder";
     }
     H.restoreIndent();
     H << sb;
@@ -839,14 +853,14 @@
 		H.zeroIndent();
 		H << nl << "protected:";
 		H.restoreIndent();
-		H << nl << "std::vector< ::IceInternal::SkippedSlice > __preserved;";
+		H << nl << "std::vector< ::Ice::SkippedSlice > __preserved;";
 	}
 	
         C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::BasicStream* __os) const";
         C << sb;
 	if(preserving) 
 	{
-	    C << nl << "for(std::vector< ::IceInternal::SkippedSlice >::const_iterator i = __preserved.begin(); i != __preserved.end(); ++i)";
+	    C << nl << "for(std::vector< ::Ice::SkippedSlice >::const_iterator i = __preserved.begin(); i != __preserved.end(); ++i)";
 	    C << sb;
 	    C << nl << "__os->write(i->typeId, false);";
 	    C << nl << "__os->writeBlob(i->slice);";
@@ -4267,7 +4281,7 @@
 
 	if(preserving)
 	{
-		C << nl << "for(std::vector< ::IceInternal::SkippedSlice >::const_iterator i = __preserved.begin(); i != __preserved.end(); ++i)";
+		C << nl << "for(std::vector< ::Ice::SkippedSlice >::const_iterator i = __preserved.begin(); i != __preserved.end(); ++i)";
 	    C << sb;
 	    C << nl << "__os->writeTypeId(i->typeId);";
 	    C << nl << "__os->writeBlob(i->slice);";
@@ -4523,7 +4537,7 @@
 	{
 	    H << sp << "protected:";
 	}
-	H << sp << nl << "::std::vector< ::IceInternal::SkippedSlice > __preserved;";
+	H << sp << nl << "::std::vector< ::Ice::SkippedSlice > __preserved;";
     }
 
     H << eb << ';';

Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/AllTests.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/AllTests.cpp?view=diff&rev=612&r1=611&r2=612
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/AllTests.cpp (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/AllTests.cpp Wed May  5 09:48:57 2010
@@ -350,6 +350,16 @@
 		ex.ud = "UnsliceableDerived";
 		ex.b = "Base";
 		throw ex;
+	}
+
+	virtual void unsliceableWithInnerClass(const Ice::Current&)
+	{
+	    ClientUnsliceableWithClass ex;
+	    ex.b = "WithInnerClass";
+	    ex.myObj = new InnerClassDerived;
+	    ex.myObj->ic = "InnerClass";
+            ex.myObj->id = "InnerClassDerived"; 
+	    throw ex;
 	}
 };
 
@@ -866,5 +876,34 @@
     }
     cout << "ok" << endl;
 
+    cout << "unsliceable derived rethrown by server with inner class..." << flush;
+    {
+        try
+	{
+            test->clientUnsliceableInnerClassRethrow(client);
+	    test(false);
+	}
+        catch(const Base& b)
+        {
+	    test(b.b == "WithInnerClass");
+            test(b.ice_name() =="Test::ClientUnsliceableWithClass");	// *NOT* sliced by server
+            const ClientUnsliceableWithClass* ex = dynamic_cast<const ClientUnsliceableWithClass*>(&b);
+            test(ex);
+            test(ex->myObj != 0);
+            test(ex->myObj->ic == "InnerClass");
+            test(ex->myObj->id == "InnerClassDerived");
+        }
+	catch(const Ice::Exception& ex)
+	{
+	    std::cerr << ex << std::endl;
+	}
+	catch(...)
+	{
+            test(false);
+        }
+    }
+
+    cout << "ok" << endl;
+
     return test;
 }

Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/ClientPrivate.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/ClientPrivate.ice?view=diff&rev=612&r1=611&r2=612
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/ClientPrivate.ice (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/ClientPrivate.ice Wed May  5 09:48:57 2010
@@ -15,6 +15,11 @@
 module Test
 {
 
+class InnerClassDerived extends InnerClass
+{
+    string id;
+};
+
 exception ClientUnknownDerived extends Base
 {
     string ud;
@@ -25,6 +30,11 @@
     string ud;
 };
 
+exception ClientUnsliceableWithClass extends BaseUnsliceable
+{
+    InnerClassDerived myObj;
+};
+
 };
 
 #endif

Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/Test.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/Test.ice?view=diff&rev=612&r1=611&r2=612
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/Test.ice (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/Test.ice Wed May  5 09:48:57 2010
@@ -38,11 +38,17 @@
 {
 };
 
+class InnerClass 
+{
+    string ic;
+};
+
 interface ClientIntf
 {
     void baseAsBase() throws Base;
     void unknownDerivedAsBase() throws Base;
     void unsliceableDerivedAsBase() throws Base;
+    void unsliceableWithInnerClass() throws Base;
 };
 
 ["ami"] interface TestIntf
@@ -69,6 +75,7 @@
     void clientBaseAsBaseRethrow(ClientIntf* client) throws Base;
     void clientUnknownDerivedAsBaseRethrow(ClientIntf* client) throws Base;
     void clientUnsliceableDerivedAsBaseRethrow(ClientIntf* client) throws Base;
+    void clientUnsliceableInnerClassRethrow(ClientIntf* client) throws Base;
 
     void shutdown();
 };

Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/TestI.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/TestI.cpp?view=diff&rev=612&r1=611&r2=612
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/TestI.cpp (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/TestI.cpp Wed May  5 09:48:57 2010
@@ -197,6 +197,19 @@
     }
 }
 
+void 
+TestI::clientUnsliceableInnerClassRethrow(const ClientIntfPrx& client, const ::Ice::Current&)
+{
+    try
+    {
+	client->unsliceableWithInnerClass();
+    }
+    catch (const Base&)
+    {
+	throw;
+    }
+}
+
 void
 TestI::shutdown(const ::Ice::Current& current)
 {

Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/TestI.h
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/TestI.h?view=diff&rev=612&r1=611&r2=612
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/TestI.h (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/TestI.h Wed May  5 09:48:57 2010
@@ -39,6 +39,7 @@
     virtual void clientBaseAsBaseRethrow(const Test::ClientIntfPrx&, const ::Ice::Current&);
     virtual void clientUnknownDerivedAsBaseRethrow(const Test::ClientIntfPrx&, const ::Ice::Current&);
     virtual void clientUnsliceableDerivedAsBaseRethrow(const Test::ClientIntfPrx&, const ::Ice::Current&);
+    virtual void clientUnsliceableInnerClassRethrow(const Test::ClientIntfPrx& client, const ::Ice::Current&);
 
     virtual void shutdown(const ::Ice::Current&);
 };

Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/AllTests.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/AllTests.cpp?view=diff&rev=612&r1=611&r2=612
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/AllTests.cpp (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/AllTests.cpp Wed May  5 09:48:57 2010
@@ -1144,6 +1144,55 @@
             d1->pd1 = d5;
 
             BPtr b1 = test->returnTest3(d5, d1);
+
+            test(b1);
+            test(b1->sb == "D5.sb");
+            test(b1->ice_id() == "::Test::D5");  // *NOT* sliced by server
+            D5Ptr p1 = D5Ptr::dynamicCast(b1);
+            test(p1);
+
+            BPtr b2 = b1->pb;
+            test(b2);
+            test(b2->sb == "D1.sb");
+            test(b2->ice_id() == "::Test::D1");
+            test(b2->pb == b1);
+            D1Ptr p3 = D1Ptr::dynamicCast(b2);
+            test(p3);
+            test(p3->sd1 == "D1.sd1");
+            test(p3->pd1 == b1);
+
+            test(b1 != d1);
+            test(b1 != d5);
+            test(b2 != d1);
+            test(b2 != d5);
+        }
+        catch(...)
+        {
+            test(false);
+        }
+    }
+    cout << "ok" << endl;
+
+    cout << "return value unsliced for input params unknown first (AMI)... " << flush;
+    {
+        try
+        {
+            D1Ptr d1 = new D1;
+            d1->sb = "D1.sb";
+            d1->sd1 = "D1.sd1";
+            D5Ptr d5 = new D5;
+            d5->pb = d1;
+            d5->sb = "D5.sb";
+            d5->sd5 = "D5.sd5";
+            d5->pd5 = d1;
+            d1->pb = d5;
+            d1->pd1 = d5;
+
+            CallbackPtr cb = new Callback;
+            test->begin_returnTest3(d5, d1, 
+                                    newCallback_TestIntf_returnTest3(cb, &Callback::response_returnTest3, &Callback::exception));
+            cb->check();
+            BPtr b1 = cb->rb;
 
             test(b1);
             test(b1->sb == "D5.sb");

Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/ClientPrivate.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/ClientPrivate.ice?view=diff&rev=612&r1=611&r2=612
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/ClientPrivate.ice (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/ClientPrivate.ice Wed May  5 09:48:57 2010
@@ -27,6 +27,12 @@
     B pd5;
 };
 
+class D6 extends BU
+{
+    string sd6;
+    D3 innerD3;
+};
+
 };
 
 #endif

Modified: ice/branches/slice-preserving-translators/cs/src/Ice/BasicStream.cs
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cs/src/Ice/BasicStream.cs?view=diff&rev=612&r1=611&r2=612
==============================================================================
--- ice/branches/slice-preserving-translators/cs/src/Ice/BasicStream.cs (original)
+++ ice/branches/slice-preserving-translators/cs/src/Ice/BasicStream.cs Wed May  5 09:48:57 2010
@@ -2275,6 +2275,7 @@
         {
             bool usesClasses = readBool();
 
+	    _currentObjectStart = _currentSliceStart = _buf.b.position();
             string id = readString();
             string origId = id;
 
@@ -2323,6 +2324,7 @@
                     }
 
                     skipSlice(); // Slice off what we don't understand.
+		    _currentSliceStart = _buf.b.position();
 
                     try
                     {

Modified: ice/branches/slice-preserving-translators/java/src/IceInternal/BasicStream.java
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/java/src/IceInternal/BasicStream.java?view=diff&rev=612&r1=611&r2=612
==============================================================================
--- ice/branches/slice-preserving-translators/java/src/IceInternal/BasicStream.java (original)
+++ ice/branches/slice-preserving-translators/java/src/IceInternal/BasicStream.java Wed May  5 09:48:57 2010
@@ -1570,6 +1570,7 @@
     {
         boolean usesClasses = readBool();
 
+	_currentObjectStart = _currentSliceStart = _buf.b.position();
         String id = readString();
         final String origId = id;
 
@@ -1618,6 +1619,7 @@
                 }
 
                 skipSlice(); // Slice off what we don't understand.
+		_currentSliceStart = _buf.b.position();
 
                 try
                 {





More information about the asterisk-scf-commits mailing list