commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 39477] New: - StringLocaleConverter uses same pattern for numbers and dates
Date Wed, 03 May 2006 20:18:07 GMT
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


Mime
View raw message