Menu

#46 Iterables getting serialized as objects (via ObjectTransformer rather than IterableTransformer)

2.0.0
closed-fixed
nobody
None
5
2014-10-14
2014-07-28
No

The bean to be serialized is a Hibernate entity; the bean property in question has the dynamic (runtime) type org.hibernate.collection.PersistentSet, which is defined as

public class PersistentSet extends AbstractPersistentCollection implements java.util.Set {
    ...
}

So this thing is instanceof java.lang.Iterable (via the java.util.Set inheritance chain only -- AbstractPersistentCollection doesn't implement any collection framework interfaces) and as such should be serialized via flexjson's IterableTransformer. That doesn't happen, apparently because the superinterface search in TypeTransformerMap#findTransformer isn't exhaustive -- it fails to search beyond two levels of superinterfaces. So it ultimately falls back to ObjectTransformer, which tries to serialize the set as a bean, which is obviously the wrong thing to do.

Discussion

  • Olaf Klischat

    Olaf Klischat - 2014-07-28

    OK, I've verified that it works in 3.2. So I guess the bug is less relevant, although 2.0 is still considered "open", right?

     
  • Charlie Hubbard

    Charlie Hubbard - 2014-10-14

    I'm closing this defect since upgrading to the latest version fixes this. Anyone on Flexjson v2.x will just need to upgrade.

     
  • Charlie Hubbard

    Charlie Hubbard - 2014-10-14
    • status: open --> closed-fixed
     

Log in to post a comment.