From d222583a4c71585b8c207e0f59441400c6ef37b4 Mon Sep 17 00:00:00 2001
From: davidely <davidely@localhost>
Date: Tue, 20 Feb 2007 12:49:29 +0000
Subject: [PATCH] Fixed ConcurrentModificationException in the unit test infrastructure that we saw with one build.  I've also added the enhancement to print the output of System.out and System.err to the command line and unit test report file for any test that fails.  I've updated the test docs on the web to reflect this.

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/TestAccessLogger.java |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/TestAccessLogger.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/TestAccessLogger.java
index b7cf9d4..7906ada 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/TestAccessLogger.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/TestAccessLogger.java
@@ -31,6 +31,7 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Iterator;
+import java.util.ArrayList;
 
 import org.opends.server.api.AccessLogger;
 import org.opends.server.api.ClientConnection;
@@ -110,16 +111,18 @@
 
 
   /**
-   * Retrieves the set of messages logged to this access logger since the last
-   * time it was cleared.  The caller must not attempt to alter the list in any
-   * way.
+   * Retrieves a copy of the set of messages logged to this error logger since
+   * the last time it was cleared.  A copy of the list is returned to avoid
+   * a ConcurrentModificationException.
    *
-   * @return  The set of messages logged to this access logger since the last
+   * @return  The set of messages logged to this error logger since the last
    *          time it was cleared.
    */
   public static List<String> getMessages()
   {
-    return SINGLETON.messageList;
+    synchronized (SINGLETON) {
+      return new ArrayList<String>(SINGLETON.messageList);
+    }
   }
 
 
@@ -129,7 +132,9 @@
    */
   public static void clear()
   {
-    SINGLETON.messageList.clear();
+    synchronized (SINGLETON) {
+      SINGLETON.messageList.clear();
+    }
   }
 
 

--
Gitblit v1.10.0