[ http://issues.apache.org/jira/browse/BEANUTILS-10?page=all ]
Niall Pemberton updated BEANUTILS-10:
-------------------------------------
Bugzilla Id: (was: 39477)
Component/s: Locale BeanUtils / Converters
> [beanutils] StringLocaleConverter uses same pattern for numbers and dates
> -------------------------------------------------------------------------
>
> Key: BEANUTILS-10
> URL: http://issues.apache.org/jira/browse/BEANUTILS-10
> Project: Commons BeanUtils
> Issue Type: Bug
> Components: Locale BeanUtils / Converters
> Environment: Operating System: All
> Platform: All
> Reporter: Brian Rodgers
> Assigned To: Henri Yandell
> Attachments: mixed-bean-test.zip
>
>
> StringLocaleConverter doesn't appear to allow for the fact that you need
> separate patterns when converting a date field than you do when converting a
> number field. Hence, when copying values from a typed bean to a String bean
> (such as when copying data into an ActionForm), if the typed bean has both
> numbers and dates, one or the other will be corrupted.
> To reproduce:
> 1. Create a bean that contains a java.util.Date field and a number (any
> numeric object or primative) field.
> 2. Create another bean with matching String fields.
> 3. Populate data into the typed bean from step 1.
> 4. Register a StringLocaleConverter using a date pattern.
> 5. User LocalBeanUtils.copyProperties to copy from the typed bean (step 1) to
> the String bean (step 2).
> 6. Print the fields in the String bean. The date field will be properly
> converted, but the number field will be formatted (to the extent that it can
> be) using the date pattern.
> Of course, it also works the other way -- specify a number pattern and the
> date field will be corrupted.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]