This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: java.sql.Timestamp thread-safety fix
- From: Bryce McKinlay <bryce at mckinlay dot net dot nz>
- To: Java Patches <java-patches at gcc dot gnu dot org>, classpath-patches at gnu dot org
- Date: Mon, 02 Aug 2004 20:20:42 -0400
- Subject: FYI: java.sql.Timestamp thread-safety fix
Access to java.util.DateFormat must be synchronized. I'm checking this in.
Regards
Bryce
2004-08-02 Bryce McKinlay <mckinlay@redhat.com>
* java/sql/Timestamp.java (valueOf): Synchronize access to dateFormat.
Index: java/sql/Timestamp.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/sql/Timestamp.java,v
retrieving revision 1.10
diff -u -r1.10 Timestamp.java
--- java/sql/Timestamp.java 15 Jul 2004 22:14:45 -0000 1.10
+++ java/sql/Timestamp.java 3 Aug 2004 00:17:07 -0000
@@ -99,7 +99,11 @@
try
{
- java.util.Date d = (java.util.Date) dateFormat.parseObject(str);
+ java.util.Date d;
+ synchronized (dateFormat)
+ {
+ d = (java.util.Date) dateFormat.parseObject(str);
+ }
if (d == null)
throw new IllegalArgumentException(str);