If when encoding a map or a vector you call encodeSummaryDataComplete(encodeIterator,true) and you receive a BUFFER_TOO_SMALL the encodeIterator becomes 'broken' and you cannot complete the encoding.
,
Our application expects to be able to encode a message in a single pass. In order to avoid unnecessary garbage collection we allocate a fixed number of buffers at application start up. If a message cannot fit within a buffer we expect to get a CodecReturnCode.BUFFER_TOO_SMALL, when we get that return code we start calling encodeComplete(encodeIterator,true) on all the nested containers, we remember where we are in the published data so we can start a continuation message re encode the nested containers and continue processing the data. Also If we get BUFFER_TOO_SMALL on creating a container we can roll it back with encodeComplete(encodeIterator,false).
BUT we can also get BUFFER_TOO_SMALL when we call encodeSummaryDataComplete(encodeIterator,true). After we receive this result code the encodeIterator seems to be 'broken', that is we cant callEncodeComplete to produce a message, The summaryData container has been encodeCompleted(true) so cant be undone either.
If you are encoding a Map/Vector with Map/Vector entries it gets more serious because failing to complete a summarydata on one of the Entry payloads causes the whole message to fail, including all the previous entriess, which in our case we dont have any more.