Fixed NPE when trying to update a vertex that has an rid bag
@@ -2,6 +2,7 @@ package com.orientechnologies.orient.core.serialization.serializer.record.binary
import com.orientechnologies.common.serialization.types.OUUIDSerializer;
import com.orientechnologies.orient.core.db.record.OIdentifiable;
+import com.orientechnologies.orient.core.db.record.ORecordElement;
import com.orientechnologies.orient.core.db.record.ridbag.ORidBag;
import com.orientechnologies.orient.core.storage.index.sbtreebonsai.local.OBonsaiBucketPointer;
import com.orientechnologies.orient.core.storage.ridbag.ORemoteTreeRidBag;
@@ -27,11 +28,22 @@ public class ORecordSerializerNetworkV37Client extends ORecordSerializerNetworkV
if (b == 1) {
ORidBag bag = new ORidBag(uuid);
int size = OVarIntSerializer.readAsInteger(bytes);
+
+ if (size > 0) {
for (int i = 0; i < size; i++) {
OIdentifiable id = readOptimizedLink(bytes);
- if (id.equals(NULL_RECORD_ID)) bag.add(null);
- else bag.add(id);
+ if (id.equals(NULL_RECORD_ID))
+ bag.add(null);
+ else
+ bag.add(id);
+ }
+
+ // The bag will mark the elements we just added as new events
+ // and marking the entire bag as a dirty transaction {@link OEmbeddedRidBag#transactionDirty}
+ // although we just deserialized it so there are no changes and the transaction isn't dirty
+ bag.transactionClear();
}
+
return bag;
} else {
long fileId = OVarIntSerializer.readAsLong(bytes);
