Wednesday, January 28, 2009

Killer WDDX - Beware!

I came across a rather interesting 'feature' tonight while working on some logging and alerting processes. We have data in a structure that holds raw information about various processes that have occurred. In one of the structure keys there is an XMLObject (coldfusion parsed xml object). See the code snippet below and DO NOT run this on production equipment!!

<cfset stcStruct = StructNew()/>

<cfset xmlDoc = "<myxml><name>Kevin Penny</name></myxml>">
<cfset stcStruct.xml = xmlParse(xmlDoc)/>
<cfset stcStruct.id = 1>

<cfwddx action="cfml2wddx" input="#stcStruct#" output="tmp"/>


This takes a Structure, adds a key of 'xml' and places a parsed xml object in it's position. I'm then serializing the data into wddx via cfwddx as cfml2wddx.

I originally thought it was the date fields that I had in the structure, so I removed those, but the problem was the xml object's serialization.

Here's the error I get along with a partial dump:
java.lang.StackOverflowError

....
at java.beans.Introspector.instantiate(Introspector.java:1438)
at java.beans.Introspector.findExplicitBeanInfo(Introspector.java:410)
at java.beans.Introspector.(Introspector.java:359)
at java.beans.Introspector.getBeanInfo(Introspector.java:222)
at java.beans.Introspector.(Introspector.java:368)
at java.beans.Introspector.getBeanInfo(Introspector.java:222)
at java.beans.Introspector.(Introspector.java:368)
at java.beans.Introspector.getBeanInfo(Introspector.java:222)
at java.beans.Introspector.(Introspector.java:368)
at java.beans.Introspector.getBeanInfo(Introspector.java:222)
at java.beans.Introspector.(Introspector.java:368)
at java.beans.Introspector.getBeanInfo(Introspector.java:222)
at java.beans.Introspector.(Introspector.java:368)
at java.beans.Introspector.getBeanInfo(Introspector.java:222)
at java.beans.Introspector.getBeanInfo(Introspector.java:208)
at coldfusion.wddx.BeanSerializer.writeObject(BeanSerializer.java:48)
at coldfusion.wddx.WddxOutputStream.writeObject(WddxOutputStream.java:310)
at coldfusion.wddx.BeanSerializer.writeObject(BeanSerializer.java:120)
at coldfusion.wddx.WddxOutputStream.writeObject(WddxOutputStream.java:310)
at coldfusion.wddx.BeanSerializer.writeObject(BeanSerializer.java:120)
at coldfusion.wddx.WddxOutputStream.writeObject(WddxOutputStream.java:310)

I've submitted this as a bug to Adobe #75230.

4 comments:

Unknown said...

Does SerializeJSON() work for xml object? If it doesn't, then I guess xml object is not a serializable "data type".

Can you maybe serialize the xml string instead? For sure that will work 'cause it'll just be a string.

Code Fusion, LLC (Kevin Penny) said...

You mean instead of using WDDX to use SerializeJSON()? I have to do some XSL on the data afterwards in this case - so the data needs to be in a format that I can reference syntactially via XPath - but certainly worth noting - Thanks Henry (and worth looking into the equivalent XSL for Json - visa vi JsonPath)

Saiful Alam said...
This comment has been removed by a blog administrator.
berny said...

I think that this application help to mane people to use in the best way many sites like viagraonline and alpino.com, so I feel so happy with the information.