BeanUtil Deserialize has exponential runtime error when deserializing arrays
----------------------------------------------------------------------------
Key: AXIS2-3010
URL: https://issues.apache.org/jira/browse/AXIS2-3010
Project: Axis 2.0 (Axis2)
Issue Type: Bug
Components: adb
Affects Versions: 1.1.1, 1.2
Environment: Windows xp, tomcat, java 1.5, running POJO services via
RPCServiceClient
Reporter: Nathan Wray
When an OMElement is deserialized into a POJO and the POJO has a setter/getter
pair with an Array parameter, the result object is created and set into the
POJO once for each member of the array. So for example an object with
String [] getHeaders()
void setHeaders(String[] h)
where h[] is an array with 80 elements, the array h will be created 80 times
and setHeaders will be called 80 times rather than once. This causes
incredibly poor performance.
It appears to be due to a pattern where each child in the element tree causes a
jump back up to the parent and a re-creation of that array result. This is
very easy to recreate by instrumenting a set method that accepts an array.
I patched this locally in the 1_1_1 version of BeanUtil by changing line 283
from
PropertyDescriptor prty = (PropertyDescriptor)
properties.get(partsLocalName);
to
PropertyDescriptor prty = (PropertyDescriptor)
properties.remove(partsLocalName);
This removes the definition of the set method after it's called the first time,
so the remainder of the array elements don't cause the entire result to be
recreated over and over.
I looked at the 1.2 code and this does not appear to be resolved. The
performance impact in my case, with 4700 result objects in an array, with each
result object having a further array of 77 fields, was huge.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]