You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2006/05/03 22:18:07 UTC
DO NOT REPLY [Bug 39477] New: - StringLocaleConverter uses same pattern for numbers and dates
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39477>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39477
Summary: StringLocaleConverter uses same pattern for numbers and
dates
Product: Commons
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: Bean Utilities
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: bkrodgers@bigfoot.com
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.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
DO NOT REPLY [Bug 39477] - [beanutils] StringLocaleConverter uses same pattern for numbers and dates
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39477>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39477
------- Additional Comments From bkrodgers@bigfoot.com 2006-05-14 05:29 -------
Created an attachment (id=18268)
--> (http://issues.apache.org/bugzilla/attachment.cgi?id=18268&action=view)
junit test case
This test case should help illustrate the problem. (You can either add the
test case to the build.xml file as a new case, or you could copy the test
method into BeanUtilsTestCase). My first JUnit test case, so let me know if I
didn't do it right. : )
Let me know if you need any further clarification as to what's going on.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
DO NOT REPLY [Bug 39477] - StringLocaleConverter uses same pattern for numbers and dates
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39477>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39477
------- Additional Comments From bayard@apache.org 2006-05-04 17:09 -------
Any chance you could attach a unit test showing your bug? I'm rusty with BeanUtils nowadays but looking
at this I'd have thought it should be fine as you can register different converters for different target types
(ConvertUtilsBean.register(Converter, Class) ).
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
DO NOT REPLY [Bug 39477] - [beanutils] StringLocaleConverter uses same pattern for numbers and dates
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39477>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39477
bayard@apache.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|StringLocaleConverter uses |[beanutils]
|same pattern for numbers and|StringLocaleConverter uses
|dates |same pattern for numbers and
| |dates
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
DO NOT REPLY [Bug 39477] - [beanutils] StringLocaleConverter uses same pattern for numbers and dates
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39477>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39477
------- Additional Comments From bayard@apache.org 2006-06-01 22:27 -------
Now in JIRA:
http://issues.apache.org/jira/browse/BEANUTILS-10
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
DO NOT REPLY [Bug 39477] - [beanutils] StringLocaleConverter uses same pattern for numbers and dates
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39477>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39477
------- Additional Comments From bkrodgers@bigfoot.com 2006-05-11 04:40 -------
The problem is that if your target is String, which is a sort of catch-all
target, you may have both numbers and dates that need to be converted to a
String. I think the primary use case that was envisioned for BeanUtils was to
copy *from* Strings *to* specific types. However, I've found it quite common
that I want to prepopulate an ActionForm from a business object, which means I'm
copying all the various specific types to Strings. If there are numbers and
dates, they'll need different formats.
I'll work on putting a junit test together for it -- may not get to it until
this weekend.
Thanks!
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org