When you write an Externalizer class, RiverMarshaller (RM) does:
writeExternalizerClass(objClass, externalizer);
And inside it:
ClassTable.Writer classTableWriter = classTable.getClassWriter(objClass);
if (classTableWriter != null)
else
{ write(Protocol.ID_EXTERNALIZER_CLASS); writeString(classResolver.getClassName(objClass)); classCache.put(objClass, classSeq++); doAnnotateClass(objClass); writeObject(externalizer); }Now, if I provide my own writer, it'll only write Protocol.ID_PREDEFINED_EXTERNALIZER_CLASS and writeClassTableData()
On the reading side, in RiverUnmarshaller (RU), the following happens:
case Protocol.ID_PREDEFINED_EXTERNALIZER_CLASS: {
final int idx = classCache.size();
classCache.add(null);
final Class<?> type = readClassTableClass();
final Externalizer externalizer = (Externalizer) readObject();
And this means that RU expects the Externalize in the wire but RM didn't write it! This fails.