Ok, I have tried to answer the question by myself:

1. ReflectData ignores built-in classes
========================================
I found the following code inside the Method "private Collection<Field> getFields(Class recordClass)":

  if (c.getPackage() != null
          && c.getPackage().getName().startsWith("java."))
        break;

The reason why built-in classes are ignored might be documented somewhere. I didn’t find anything about the reason.
[AVRO-797] might have something to do with this issue.

The fields within the Properties.class (inherited from Hashtable) are declared as transient. Even if the code above is comment out, the class is not serialized through Avro. But: Java is able to serialize this class?!?

Why is Java able to serialize this class and Avro not?
======================================================
First: The serialization process of java does have the same problem as Avro: For sure, the fields are transient for boths APIs. But here is the extra edge: A closer look into the class hashtable shows that the specific methods "readObject" and "writeObject" (used for serialization) are overwritten. Avro does not consider these methods (whichs write specific binary-content direct into the outputstream). I think that's the reason why the class is serialized by the JAVA Serialization and not by Avro.

How can this problem be solved?
===============================
Don't use built-in classes in your data model.

Regards

Stefan

--
This email was Anti Virus checked by Astaro Security Gateway. 
http://www.astaro.com

Reply via email to