This is an automated email from the git hooks/post-receive script.

eugene-guest pushed a commit to annotated tag OpenBSD
in repository testng.

commit 4d03b7555615774c228120c115d3094895e6a6b5
Author: mcosby <[email protected]>
Date:   Thu Jun 12 12:36:19 2014 -0500

    externally synchronize our use of the static SimpleDateFormat
    
    When running testng multi-threaded, multiple TimeBombSkipExceptions in 
different tests will occasionally die with a parsing exception. Given the 
choice of making SDF not static or adding the synchronized, I just added the 
synchronized - but I don't have a preference either way.
---
 src/main/java/org/testng/TimeBombSkipException.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/testng/TimeBombSkipException.java 
b/src/main/java/org/testng/TimeBombSkipException.java
index 96dcb2d..c386b06 100755
--- a/src/main/java/org/testng/TimeBombSkipException.java
+++ b/src/main/java/org/testng/TimeBombSkipException.java
@@ -181,7 +181,11 @@ public class TimeBombSkipException extends SkipException {
 
   private void initExpireDate(String date) {
     try {
-      Date d= m_inFormat.parse(date);
+      // SimpleDateFormat is not thread-safe, and m_inFormat 
+      // is, by default, connected to the static SDF variable
+      synchronized( m_inFormat ){
+        Date d= m_inFormat.parse(date);
+      }
       initExpireDate(d);
     }
     catch(ParseException pex) {

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-java/testng.git

_______________________________________________
pkg-java-commits mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

Reply via email to