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]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>