java - How does serialization tool skip unknown fields during deserialization? -


how serialization tool(i.e. hessian) deserialize class of different version same serialversionuid? in cases, can skip unknown(not found in class loader) fields , keep compatible. last time, tried appending new field of map<string, object>, put unknown object map, threw classnotfoundexception.

  • why can't skip map others?
  • is problem associated tool's implementation or serialization mechanism?

this depend on tool itself. serialversionuid intended use java's built-in serializer (objectoutputstream) which, best can tell reading hessian source, not used hessian.

for hessian specifically, best source can find mentions these kinds of changes this email:

at least hessian, it's best think of versioning set of types of changes can handled.

specifically hessian can manage following kinds of changes: 1) if add or drop field, side doesn't understand field ignore it. 2) field type changes possible, if hessian can convert (e.g. int long) 3) there's flexibility on map(bean) types, depending on how information hessian has (which reason prefer concrete types.)

so, if sender sends untyped map {"field1", 10} , target known myvalue { int field1; }, hessian can map fields.

but cannot manage things like: 1) field name changes (the data dropped). 2) class name changes target underdefined, object field1. if send myvalue2 new field1, when previous version myvalue1, hessian can't make automatic transition. (but #3 above, "myvalue2 field1" give hessian enough information translate.) 3) class splits, e.g. creating subclass , pushing fields it.
4) map list or list map changes.

basically, don't think hessian intends support unknown types in maps.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -