Archived
This forum has been archived. Please start a new discussion on GitHub.
Deeply nested optional sequences lead to serialization error.
in Bug Reports
Hello, I have run across a bug using optional values in Ice 3.5.1 (java).
Given a slice definition like this:
Outer#__writeImpl will contain this code fragment:
Inner1#__writeImpl will contain this code fragment:
During serialization, the inner calls of startSize/endSize will reset BasicStream._sizePos to -1.
When execution reaches the outer endSize, an exception occurs like the following:
I hope you find this information useful.
Given a slice definition like this:
module Demo { class Inner0 { int value; }; sequence<Inner0> Inner0Seq; class Inner1 { optional(0) Inner0Seq value; }; sequence<Inner1> Inner1Seq; class Outer { optional(0) Inner1Seq value; }; };
Outer#__writeImpl will contain this code fragment:
__os.startSize(); Inner1SeqHelper.write(__os, value); __os.endSize();
Inner1#__writeImpl will contain this code fragment:
__os.startSize(); Inner0SeqHelper.write(__os, value); __os.endSize();
During serialization, the inner calls of startSize/endSize will reset BasicStream._sizePos to -1.
When execution reaches the outer endSize, an exception occurs like the following:
java.lang.IndexOutOfBoundsException at java.nio.Buffer.checkIndex(Buffer.java:538) at java.nio.HeapByteBuffer.putInt(HeapByteBuffer.java:375) at IceInternal.BasicStream.rewriteInt(BasicStream.java:1233) at IceInternal.BasicStream.endSize(BasicStream.java:726)
I hope you find this information useful.
0
Comments
-
Hi,
Thanks for the bug report, we will look into fixing this! This problem doesn't affect the C++ implementation but it's an issue for other language mappings.
Cheers,
Benoit.0