diff options
author | Benoit Foucher <benoit@zeroc.com> | 2012-06-12 16:50:58 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2012-06-12 16:50:58 +0200 |
commit | b2c3f4fe51800183e78db500b1e91d0135689caf (patch) | |
tree | f515d08d95609db34b4a6b2c898a488e5fe6be4d /cpp/src/Ice/BasicStream.cpp | |
parent | demo fixes (diff) | |
download | ice-b2c3f4fe51800183e78db500b1e91d0135689caf.tar.bz2 ice-b2c3f4fe51800183e78db500b1e91d0135689caf.tar.xz ice-b2c3f4fe51800183e78db500b1e91d0135689caf.zip |
Fixed support unknown types in unknown optionals
Diffstat (limited to 'cpp/src/Ice/BasicStream.cpp')
-rwxr-xr-x | cpp/src/Ice/BasicStream.cpp | 58 |
1 files changed, 37 insertions, 21 deletions
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp index e08d7ad9b49..ddd4dfa60ac 100755 --- a/cpp/src/Ice/BasicStream.cpp +++ b/cpp/src/Ice/BasicStream.cpp @@ -2312,12 +2312,19 @@ IceInternal::BasicStream::EncapsDecoder::throwException(const UserExceptionFacto traceSlicing("exception", _typeId, _slicingCat, _stream->instance()->initializationData().logger); } + // + // Slice off what we don't understand. + // + skipSlice(); + + // + // If this is the last slice, raise an exception and stop un-marshalling. + // if(_sliceFlags & FLAG_IS_LAST_SLICE) { throw NoExceptionFactoryException(__FILE__, __LINE__, "", "unknown exception type `" + mostDerivedId + "'"); } - skipSlice(); // Slice off what we don't understand. try { startSlice(); @@ -2654,12 +2661,10 @@ IceInternal::BasicStream::EncapsDecoder::readInstance() while(true) { // - // For the 1.0 encoding, the type ID for the base Object class marks - // the last slice. For later encodings, an empty type ID means the - // class was marshaled in the compact format and therefore cannot be - // sliced. + // For the 1.0 encoding, the type ID for the base Object class + // marks the last slice. // - if(_typeId.empty() || _typeId == Object::ice_staticId()) + if(_typeId == Object::ice_staticId()) { throw NoObjectFactoryException(__FILE__, __LINE__, "", mostDerivedId); } @@ -2709,32 +2714,41 @@ IceInternal::BasicStream::EncapsDecoder::readInstance() } // - // If object slicing is disabled, or if the flags indicate that this is the - // last slice (for encodings >= 1.1), we raise NoObjectFactoryException. + // Performance sensitive, so we use lazy initialization for tracing. // - if(!_sliceObjects) + if(_traceSlicing == -1) { - throw NoObjectFactoryException(__FILE__, __LINE__, "object slicing is disabled", _typeId); + _traceSlicing = _stream->instance()->traceLevels()->slicing; + _slicingCat = _stream->instance()->traceLevels()->slicingCat; } - else if(_sliceFlags & FLAG_IS_LAST_SLICE) + if(_traceSlicing > 0) { - throw NoObjectFactoryException(__FILE__, __LINE__, "", _typeId); + traceSlicing("class", _typeId, _slicingCat, _stream->instance()->initializationData().logger); } // - // Performance sensitive, so we use lazy initialization for tracing. + // If object slicing is disabled, stop un-marshalling. // - if(_traceSlicing == -1) + if(!_sliceObjects) { - _traceSlicing = _stream->instance()->traceLevels()->slicing; - _slicingCat = _stream->instance()->traceLevels()->slicingCat; + throw NoObjectFactoryException(__FILE__, __LINE__, "object slicing is disabled", _typeId); } - if(_traceSlicing > 0) + + // + // Slice off what we don't understand. + // + skipSlice(); + + // + // If this is the last slice, keep the object as an opaque + // UnknownSlicedData object. + // + if(_sliceFlags & FLAG_IS_LAST_SLICE) { - traceSlicing("class", _typeId, _slicingCat, _stream->instance()->initializationData().logger); + v = new UnknownSlicedObject(mostDerivedId); + break; } - skipSlice(); // Slice off what we don't understand. startSlice(); // Read next Slice header for next iteration. } @@ -2828,7 +2842,9 @@ IceInternal::BasicStream::EncapsDecoder::skipSlice() } else { - throw MarshalException(__FILE__, __LINE__, "compact format prevents slicing"); + throw MarshalException(__FILE__, + __LINE__, + "compact format prevents slicing (the sender should use the sliced format instead)"); } if(_encaps->encoding != Encoding_1_0) @@ -2899,7 +2915,7 @@ IceInternal::BasicStream::EncapsDecoder::readSlicedData() { throw MarshalException(__FILE__, __LINE__, "invalid id in object indirection table"); } - addPatchEntry(id, &patchHandle<Ice::Object>, &_slices[n]->objects[j++]); + addPatchEntry(id, &patchHandle<Object>, &_slices[n]->objects[j++]); } } |