Buggy code:
public class ORidBag implements OCollection < OIdentifiable > , ORecordLazyMultiValue , OTrackedMultiValue < OIdentifiable , OIdentifiable > , OStringBuilderSerializable , Iterable < OIdentifiable > { private ORidBagDelegate delegate ; private int topThreshold = RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD . getValueAsInteger ( ) ; private int bottomThreshold = RID_BAG_SBTREEBONSAI_TO_EMBEDDED_THRESHOLD . getValueAsInteger ( ) ; private UUID uuid ; public ORidBag ( final ORidBag ridBag ) { } public ORidBag ( ) { } public ORidBag ( final int iTopThreshold , final int iBottomThreshold ) { } private ORidBag ( final byte [ ] stream ) { } public static ORidBag fromStream ( final String value ) { } public ORidBag copy ( ) { } public void addAll ( Collection < OIdentifiable > values ) { } public void add ( OIdentifiable identifiable ) { } public void remove ( OIdentifiable identifiable ) { } public boolean isEmpty ( ) { } @ Override public Iterator < OIdentifiable > iterator ( ) { } @ Override public Iterator < OIdentifiable > rawIterator ( ) { } @ Override public void convertLinks2Records ( ) { } @ Override public boolean convertRecords2Links ( ) { } @ Override public boolean isAutoConvertToRecord ( ) { } @ Override public void setAutoConvertToRecord ( boolean convertToRecord ) { } @ Override public boolean detach ( ) { } @ Override public int size ( ) { } public boolean isEmbedded ( ) { } public int toStream ( BytesContainer bytesContainer ) throws OSerializationException { } @ Override public OStringBuilderSerializable toStream ( StringBuilder output ) throws OSerializationException { } @ Override public String toString ( ) { } public void delete ( ) { } @ Override public OStringBuilderSerializable fromStream ( StringBuilder input ) throws OSerializationException { } public void fromStream ( final byte [ ] stream ) { } public void fromStream ( BytesContainer stream ) { final byte first = stream . bytes [ ( ( stream . offset ) ++ ) ] ; if ( ( first & 1 ) == 1 ) delegate = new OEmbeddedRidBag ( ) ; else delegate = new OSBTreeRidBag ( ) ; if ( ( first & 2 ) == 2 ) { uuid = INSTANCE . deserialize ( stream . bytes , stream . offset ) ; stream . skip ( UUID_SIZE ) ; } <START_BUG> stream . skip ( delegate . deserialize ( stream . bytes , stream . offset ) ) ; <END_BUG> } @ Override public void addChangeListener ( final OMultiValueChangeListener < OIdentifiable , OIdentifiable > changeListener ) { } @ Override public void removeRecordChangeListener ( final OMultiValueChangeListener < OIdentifiable , OIdentifiable > changeListener ) { } @ Override public Object returnOriginalState ( List < OMultiValueChangeEvent < OIdentifiable , OIdentifiable > > multiValueChangeEvents ) { } @ Override public Class < ? > getGenericClass ( ) { } public void setOwner ( ORecord owner ) { } public UUID getTemporaryId ( ) { } public void notifySaved ( OBonsaiCollectionPointer newPointer ) { } public OBonsaiCollectionPointer getPointer ( ) { } public boolean tryMerge ( final ORidBag otherValue , boolean iMergeSingleItemsOfMultiValueFields ) { } protected void init ( ) { } private void replaceWithSBTree ( OBonsaiCollectionPointer pointer ) { } }

Fix:
stream . skip ( ( ( delegate . deserialize ( stream . bytes , stream . offset ) ) - ( stream . offset ) ) ) ;