i'm afraid that i've got some bad news. LocaleBeanUtils.copyProperties does not (at the moment) support locale-aware conversions. i looked into the work that would be required but it's quite large.
the next beanutils release is coming very soon now and i don't think that this will get done before then. i've added this as a bug to bugzilla (http:
//nagoya.apache.org/bugzilla/show_bug.cgi?id=16038) so if you want to keep track of progress you can add yourself as a CC.
if you're only using your default locale then maybe registering DoubleLocaleConverter with ConvertUtils as the Double converter (before calling copyProperties) might work.
- robert
On Sunday, January 12, 2003, at 05:52 PM, xavi caballe wrote:
Hello, I have a problem with the locale-dependent version of BeanUtils. I have 2 beans, OrigBean and DestBean. OrigBean has a property named price (with corresponding getter and setter) whose type is String. DestBean has a property named price (with corresponding getter and setter) whose type is Double.Then I have the following code: OrigBean orig = new OrigBean(); // "," IS THE DECIMAL SYMBOL IN SPANISH (my locale) orig.setPrice("123,54"); DestBean dest = new DestBean(); try { LocaleBeanUtils.copyProperties(dest, orig); } catch (Exception e) { System.out.println(e.getMessage()); } System.out.println("dest.price:" + dest.getPrice()); System.out.println(java.util.Locale.getDefault()); java.text.NumberFormat df = java.text.DecimalFormat.getInstance(); System.out.println(((java.text.DecimalFormat)df).getDecimalFormatSymbols( ).getDecimalSeparator()); and I get the following output: dest.price:0.0 es_ES , Why? I should get "123.54", shouldn't I? Am I doing something wrong? I would appreciate your help. Thanks in advance. Xavi -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]. org> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]. org>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
