Program: 43001
Project: 43001
Buggy source:
private void doInitSerializable(final Object obj,final SerializableClassDescriptor descriptor) throws IOException, ClassNotFoundException {
  final Class<?> type=descriptor.getType();
  final SerializableClass info=registry.lookup(type);
  final ClassDescriptor superDescriptor=descriptor.getSuperClassDescriptor();
  if (superDescriptor instanceof SerializableClassDescriptor) {
    final SerializableClassDescriptor serializableSuperDescriptor=(SerializableClassDescriptor)superDescriptor;
    doInitSerializable(obj,serializableSuperDescriptor);
  }
  final int typeId=descriptor.getTypeID();
  final BlockUnmarshaller blockUnmarshaller=getBlockUnmarshaller();
  if (descriptor.isGap()) {
    if (info.hasReadObjectNoData()) {
      info.callReadObjectNoData(obj);
    }
  }
 else   if (info.hasReadObject()) {
    final RiverObjectInputStream objectInputStream=getObjectInputStream();
    final SerializableClassDescriptor oldDescriptor=objectInputStream.swapClass(descriptor);
    final Object oldObj=objectInputStream.swapCurrent(obj);
    final RiverObjectInputStream.State restoreState=objectInputStream.start();
    boolean ok=false;
    try {
      if (typeId == ID_WRITE_OBJECT_CLASS) {
        info.callReadObject(obj,objectInputStream);
        blockUnmarshaller.readToEndBlockData();
        blockUnmarshaller.unblock();
      }
 else {
        blockUnmarshaller.endOfStream();
        info.callReadObject(obj,objectInputStream);
      }
      objectInputStream.finish(restoreState);
      objectInputStream.swapCurrent(oldObj);
      objectInputStream.swapClass(oldDescriptor);
      ok=true;
    }
  finally {
      if (!ok) {
        objectInputStream.fullReset();
      }
    }
  }
 else {
    readFields(obj,descriptor);
    if (typeId == ID_WRITE_OBJECT_CLASS) {
      blockUnmarshaller.readToEndBlockData();
      blockUnmarshaller.unblock();
    }
  }
}

Fixed version (ground truth):
private void doInitSerializable(final Object obj,final SerializableClassDescriptor descriptor) throws IOException, ClassNotFoundException {
  final Class<?> type=descriptor.getType();
  final SerializableClass info=registry.lookup(type);
  final ClassDescriptor superDescriptor=descriptor.getSuperClassDescriptor();
  if (superDescriptor instanceof SerializableClassDescriptor) {
    final SerializableClassDescriptor serializableSuperDescriptor=(SerializableClassDescriptor)superDescriptor;
    doInitSerializable(obj,serializableSuperDescriptor);
  }
  final int typeId=descriptor.getTypeID();
  final BlockUnmarshaller blockUnmarshaller=getBlockUnmarshaller();
  if (descriptor.isGap()) {
    if (info.hasReadObjectNoData()) {
      info.callReadObjectNoData(obj);
    }
  }
 else   if (info.hasReadObject()) {
    final RiverObjectInputStream objectInputStream=getObjectInputStream();
    final SerializableClassDescriptor oldDescriptor=objectInputStream.swapClass(descriptor);
    final Object oldObj=objectInputStream.swapCurrent(obj);
    final RiverObjectInputStream.State restoreState=objectInputStream.start();
    boolean ok=false;
    try {
      if (typeId == ID_WRITE_OBJECT_CLASS) {
        info.callReadObject(obj,objectInputStream);
        blockUnmarshaller.readToEndBlockData();
        blockUnmarshaller.unblock();
      }
 else {
        objectInputStream.noCustomData();
        info.callReadObject(obj,objectInputStream);
        blockUnmarshaller.restore(objectInputStream.getRestoreIdx());
      }
      objectInputStream.finish(restoreState);
      objectInputStream.swapCurrent(oldObj);
      objectInputStream.swapClass(oldDescriptor);
      ok=true;
    }
  finally {
      if (!ok) {
        objectInputStream.fullReset();
      }
    }
  }
 else {
    readFields(obj,descriptor);
    if (typeId == ID_WRITE_OBJECT_CLASS) {
      blockUnmarshaller.readToEndBlockData();
      blockUnmarshaller.unblock();
    }
  }
}