unlockha / beanio

Automatically exported from code.google.com/p/beanio
Apache License 2.0
1 stars 0 forks source link

Default locale is always used to print a number #85

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When marshalling an object, default locale is always used even if 
createDecimalFormat is overriden. This is because the format method doesn't use 
that factory method.

    public String format(Object value) {
        if (value == null)
            return null;
        else if (pattern == null)
            return ((Number) value).toString();
        else
            return new DecimalFormat(pattern).format(value);
    }

As a workaround, I overrided this method too with:

    public String format(Object value) {
        if (value == null)
            return null;
        else if (pattern == null)
            return ((Number) value).toString();
        else
            return createDecimalFormat().format(value);
    }

Original issue reported on code.google.com by fbar...@gmail.com on 19 Jun 2013 at 6:19

GoogleCodeExporter commented 8 years ago
Fixed for release 2.0.7.  Snapshot JAR attached.

Original comment by kevin.s...@gmail.com on 20 Jun 2013 at 2:29

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by kevin.s...@gmail.com on 7 Sep 2013 at 6:19