classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: java.sql.Timestamp thread-safety fix


From: Bryce McKinlay
Subject: [cp-patches] FYI: java.sql.Timestamp thread-safety fix
Date: Mon, 02 Aug 2004 20:20:42 -0400
User-agent: Mozilla Thunderbird 0.5 (X11/20040626)

Access to java.util.DateFormat must be synchronized. I'm checking this in.

Regards

Bryce


2004-08-02  Bryce McKinlay  <address@hidden>

   * 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);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]