_depth++;
try {
final ObjectInputStream ois = new OldValueInputStream(this);
object = ois.readObject();
if (_next != _end) {
throw new ConversionException("Invalid serialized Object at index=" + _next);
}
closeVariableLengthItem();
} catch (final IOException ioe) {
throw new ConversionException("@" + start, ioe);
} catch (final ClassNotFoundException cnfe) {
throw new ConversionException("@" + start, cnfe);
} finally {
_depth--;
}
break;
case CLASS_REREF: {
final int base = _bytes[_next++] & 0xFF;
final int handle = decodeVariableLengthInt(base);
object = getValueCache().get(handle);
break;
}
case TYPE_MVV: {
final int savedSize = _size;
final ArrayList<Object> outList = new ArrayList<Object>();
try {
_depth++;
MVV.visitAllVersions(new MVV.VersionVisitor() {
@Override
public void init() {
}
@Override
public void sawVersion(final long version, final int offset, final int valueLength) {
Object obj = null;
if (valueLength > 0) {
_next = offset;
_end = _size = _next + valueLength;
obj = get(target, context);
}
outList.add(obj);
}
}, getEncodedBytes(), 0, getEncodedSize());
} catch (final PersistitException pe) {
throw new ConversionException("@" + start, pe);
} finally {
_depth--;
_next = _end = _size = savedSize;
}
return outList.toArray();
}
default: {
final int saveDepth = _depth;
try {
_depth++;
final Class<?> cl = _persistit.classForHandle(classHandle);
final ValueCoder coder = getValueCoder(cl);
if (coder != null) {
if (target == null) {
object = coder.get(this, cl, context);
}
else if (coder instanceof ValueRenderer) {
((ValueRenderer) coder).render(this, target, cl, context);
object = target;
} else {
throw new ConversionException("No ValueRenderer for class " + cl.getName());
}
} else {
throw new ConversionException("No ValueCoder for class " + cl.getName());
}
} finally {
_depth = saveDepth;
}
closeVariableLengthItem();