My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 38: XmlArray getFromCache idref deserialisation bug when a cacheProvider isn't set via configuration
1 person starred this issue and may be notified of changes. Back to list
Status:  Verified
Owner:  ----
Closed:  Feb 2011


 
Reported by domdelor...@gmail.com, Feb 13, 2011
Using getFromCache and idref metadata on [XmlAttribute] and [XmlElement] works as expected (returns reference to cached object)

Using it on [XmlArray] returns uncached objects every time unless a cacheProvider is set manually in the configuration prior to de serialisation.


What steps will reproduce the problem?
1. Run attached example without setting FxBEngine.instance.getXmlSerializer().configuration.cacheProvider

2. Run the example again with the following configuration.cacheProvider = new ObjectCache()


What is the expected output? What do you see instead?

- In the first test [XmlArray] returns a reference to the wrong item (while XmlAttribute and XmlElement return the correct one
- In the second test they all return the correct item.


What version of the product are you using? On what operating system?
FlexXb 2.0, Flex4

Please provide any additional information below.

This is very confusing as i'd expect the same caching behaviour for XmlElement, XmlAttribute and XMlArray without having to set a cacheProvider.

From the documentation I wouldn't expect to have to set a cacheProvider for use case (my understanding is that this configuration point is for using a custom cache provider rather than the default).


FlexXB_cache_bug.zip
2.3 MB   Download
Feb 14, 2011
Project Member #1 alex.id....@gmail.com
By default there is no cache provider set in configuration so no object is cached. In order to activate the object cacching you need to set a cache provider instance in the configuration. This seems to be an idRef problem in the serializer for XmlArray. I'll take a look at it.
Feb 14, 2011
Project Member #2 alex.id....@gmail.com
(No comment was entered for this change.)
Status: Accepted
Labels: Milestone-2.0.1
Feb 14, 2011
Project Member #3 alex.id....@gmail.com
(No comment was entered for this change.)
Status: Started
Feb 14, 2011
#4 domdelor...@gmail.com
It makes sense to have to set a cache provider - I think what is confusing
is that local attribute and element idref caching still works without
setting one.
Feb 15, 2011
Project Member #5 alex.id....@gmail.com
Well, idRef is a different concept than caching; jaxb has this feature too (actually this is what inspired me to add it in flexxb :) - https://jaxb.dev.java.net/guide/Mapping_cyclic_references_to_XML.html). 
IdRef only works within the current xml document and allows you to make links to the same objects used as references. Caching is global to the application itself while idref works on document level. One is not required to activate caching in order to have proper referenced objects via idref.
I agree it may be a little confusing. 
Feb 15, 2011
#6 domdelor...@gmail.com
Hi alex,

That makes a lot of sense. Not being familiar with jaxb i've just assumed both were required for caching. That may explain another issue I've had where references in a pre existing ObjectCache weren't being picked up during deserialization.

FlexXB is an excellent framework by the way - its been invaluable on several projects in the past and i think the direction you are taking it with 2.x is fantastic!


Dominic De Lorenzo
Feb 15, 2011
Project Member #7 alex.id....@gmail.com
Thanks for the appreciation. I think it's a natural evolution for FlexXB 2.x to be able to support all kinds of serialization formats: XML, JSON, ASN1(with its various encodings), AMF etc. When I have the time I'll release a JSON extension to FlexXB 2.x.

Alex
Feb 19, 2011
Project Member #8 alex.id....@gmail.com
(No comment was entered for this change.)
Status: Fixed
Mar 23, 2011
Project Member #9 alex.id....@gmail.com
(No comment was entered for this change.)
Status: Verified

Powered by Google Project Hosting