Hi there,

I have made a patch that fixes the problem with the non-threadsafe property editors in 
the current 1.3 RC1 release.
It also gives a slight performance increase like 10-20% for pages that uses editors 
alot (many method calls, lots of data etc).
The new code should be backwards-compatible so no changes are needed for your code.

I have made the following changes:

- Created an interface FastPropertyEditor with the methods: String getAsText(Object) 
and Object getAsValue(String)
- Changed all Webwork property editors to implement the interface. Added editors to 
cover the base classes (primitives) that we used Suns editors for before.
- Changed BeanUtil to only cache instances of FastPropertyEditor.
- Changed BeanUtil.toStringValue to use FastPropertyEditors.
- Changed BeanUtil.toStringValue so that if the Object is a String then it is just 
returned. This means that no PropertyEditor is looked for then!  I hope this is ok for 
everybody!
This whole performance problem really started out when Jira issue WW-41 was 
implemented (for release 1.2.1) so that PropertyEditors should be used when displaying 
values. As I recall this was added on request by Patrick Lightbody and I think he was 
going to use it for date formatting mainly. So it seems ok to just return the Strings 
to me.

- Changed ValueStack to use BeanUtil to lookup and use PropertyEditors.
- Changed ValidationEditorSupport to implement the String getAsText(Object) method

If you have registered your own PropertyEditors with the PropertyEditorManager that 
will still work. To optimize you can also make them implement the FastPropertyEditor 
interface.

I did not do any changes to BeanUtil for the cases when PropertyEditors are used in 
conjunction with PropertyDescriptors. That code is working the way it is even though 
it could be made faster.

I am running this code on my system and things are working fine.
Maybe the patch could be added so that the 1.3 version could be released?

Best regards,

Dick Zetterberg

[EMAIL PROTECTED]

Attachment: ToWebwork.zip
Description: Zip compressed data

Reply via email to