Bug 3819

Summary: getNumber w/custom format doesn't take care of locale, fix included
Product: Taglibs Reporter: R <rguyomarch>
Component: DBTags TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 1.0B1   
Target Milestone: ---   
Hardware: PC   
OS: FreeBSD   

Description R 2001-09-25 11:29:32 UTC
If the current locale is "en_US", this tag :
<sql:getNumber position="1" format="0.00" locale="fr_FR"/>
will print "12.34" instead of "12,34" as it should.
                                 ^

The problem is in GetNumberTag.java, there :

 private static NumberFormat getNumberFormat (String strFormat, Locale loc)
  {
    NumberFormat fmt;
...
    else
      fmt = new DecimalFormat (strFormat);

I think this last line should be :

      fmt = new DecimalFormat (strFormat, new DecimalFormatSymbols(loc));

(although I didn't tested this fix)
Comment 1 R 2001-09-25 11:37:52 UTC
(changed the bugzilla version field to 1.0B1)
Comment 2 Morgan Delagrange 2002-04-15 03:51:22 UTC
I confirmed the problem and applied the fix.