internal IPersistent LoadStub(int oid, IPersistent obj, Type cls) { long pos = GetPos(oid); if ((pos & (dbFreeHandleFlag | dbPageObjectFlag)) != 0) { throw new StorageError(StorageError.DELETED_OBJECT); } byte[] body = pool.Get(pos & ~ dbFlagsMask); ClassDescriptor desc; int typeOid = ObjectHeader.GetType(body, 0); if (typeOid == 0) { //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. desc = (ClassDescriptor) classDescMap[cls]; } else { desc = FindClassDescriptor(typeOid); } if (obj == null) { obj = (IPersistent) desc.NewInstance(); objectCache.Put(oid, obj); } obj.AssignOid(this, oid, false); if (obj is FastSerializable) { ((FastSerializable) obj).Unpack(body, ObjectHeader.Sizeof, encoding); } else { try { UnpackObject(obj, desc, obj.RecursiveLoading, body, ObjectHeader.Sizeof, obj); } catch (System.Exception x) { throw new StorageError(StorageError.ACCESS_VIOLATION, x); } } obj.OnLoad(); return obj; }