Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
Name: boT120536 Date: 04/22/2001 Here is source code version: /* * @(#)DecimalFormat.java 1.57 00/01/19 * * Copyright 1996-2000 Sun Microsystems, Inc. All Rights Reserved. * * This software is the proprietary information of Sun Microsystems, Inc. * Use is subject to license terms. * */ The routing java.text.DecimalFormat is not thread safe. We are facing problems when concurrent accesses are done to a single SimpleDateFormat for parsing a date with format "yyMMddHHmmss". The stack trace is: java.lang.NumberFormatException: at java.lang.Long.parseLong(Long.java:331) at java.lang.Long.parseLong(Long.java:363) at java.text.DigitList.getLong(DigitList.java:153) at java.text.DecimalFormat.parse(DecimalFormat.java:808) at java.text.SimpleDateFormat.subparse(SimpleDateFormat.java:987) at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:708) ... After many investigations and examination of Java core libray source code as provided with JBuilder Entreprise edition 4.0, I reached the following diagnostic. The accesses to the private 'digitList' field should be protected through critical section. It is the case at line 441 and 498 in DecimalFormat.java However, there is a LACK of critical section between line 793 (which is setting digitList) and line 808 (which is using it). It should guarranteed that no acces can be performed by a concurrentely running thread that would reset or modify the digitList field betwezen those lines. (Review ID: 120972) ======================================================================
|