commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject cvs commit: jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters DecimalLocaleConverter.java
Date Thu, 03 Jun 2004 21:49:31 GMT
rdonkin     2004/06/03 14:49:31

  Modified:    beanutils/src/java/org/apache/commons/beanutils/locale/converters
                        DecimalLocaleConverter.java
  Log:
  Fixed thread safety issue with DecimalFormat. Raised in issue #27809
  
  Revision  Changes    Path
  1.9       +3 -5      jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/DecimalLocaleConverter.java
  
  Index: DecimalLocaleConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/DecimalLocaleConverter.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DecimalLocaleConverter.java	28 Feb 2004 13:18:35 -0000	1.8
  +++ DecimalLocaleConverter.java	3 Jun 2004 21:49:31 -0000	1.9
  @@ -46,9 +46,6 @@
       /** All logging goes through this logger */
       private static Log log = LogFactory.getLog(DecimalLocaleConverter.class);     
   
  -    /** The Decimal formatter */
  -    private DecimalFormat formatter = null;
  -
       // ----------------------------------------------------------- Constructors
   
       /**
  @@ -211,7 +208,7 @@
       public DecimalLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean
locPattern) {
   
           super(defaultValue, locale, pattern, locPattern);
  -	formatter = (DecimalFormat) DecimalFormat.getInstance(locale);
  +	
       }
   
       // --------------------------------------------------------- Methods
  @@ -227,7 +224,8 @@
        *  successfully
        */
       protected Object parse(Object value, String pattern) throws ParseException {
  -
  +        // DecimalFormat is not thread safe so best to construct one each time
  +        DecimalFormat formatter = (DecimalFormat) DecimalFormat.getInstance(locale);
           // if some constructors default pattern to null, it makes only sense to handle
null pattern gracefully
           if (pattern != null) {
               if (locPattern) {
  
  
  

---------------------------------------------------------------------
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