Skip to content

Conversation

@benblamey
Copy link
Member

No description provided.

m.addDemoJexlTier();
m.addDemoJexlTier();
m.addDemoJexlTier();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haoyuan-l I have created a unit test for the XML serliazation.
Unfortunately the serialization doesn't behave nicely. I have not been able to configure it to handle the inheritance correctly, and it is getting confused when trying to de-serialize

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any errors when you deserialized the tiers list?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, its broken at the moment. There will be some errors, but since these are on worker threads, they only kill those threads. The problem is that the deserializaton itself fails, for example because ctors are missing.

This kind of serialization needs special handling for everything which is not a plain 'java bean' property

Manager m2 = new Manager();

// we get this error:
// java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.benblamey.hom.manager.JexlDeploymentTier` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haoyuan-l I can make more progress using JSON.... now it is complaining that the ctor doesn't exist.
The classes need to handle the deserialization....

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haoyuan-l I can make more progress using JSON.... now it is complaining that the ctor doesn't exist. The classes need to handle the deserialization....

So currently we can serialize the tier list to a JSON file but broke when we deserialized the file. Can you share a snapshot of the JSON file? And also I found a post about deserializing the Arraylist:
https://stackoverflow.com/questions/9829403/deserialize-json-to-arraylistpojo-using-jackson

Not sure... It seems we deserialized to ArrayList without any generic type.
(e.g. List tiers = (List)m_xmlMapper.readValue(fr, ArrayList.class))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

work-in-progress do not merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants