This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]