summaryrefslogtreecommitdiff
path: root/jurt
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2003-04-23 16:07:53 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2003-04-23 16:07:53 +0000
commitb059c931e29091fe478131500efa619754dd3abd (patch)
tree99e4ee5cb2ec63d2fe4929c7171e9e84d9e10b7b /jurt
parentf85639841880c148cd10a1d8ec854aa83693bcbe (diff)
INTEGRATION: CWS uno2 (1.8.40); FILE MERGED
2003/04/07 08:38:11 sb 1.8.40.1: #108678# Added test case for bug 108675 (detected while fixing this bug).
Diffstat (limited to 'jurt')
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java39
1 files changed, 32 insertions, 7 deletions
diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java b/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java
index a0e2bf4e6f05..7174bcbe51a1 100644
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java
+++ b/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java
@@ -2,9 +2,9 @@
*
* $RCSfile: ThreadPool_Test.java,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: jbu $ $Date: 2001-11-02 17:06:11 $
+ * last change: $Author: rt $ $Date: 2003-04-23 17:07:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -65,6 +65,7 @@ package com.sun.star.lib.uno.environments.remote;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Hashtable;
import java.util.Enumeration;
import java.util.Vector;
@@ -193,6 +194,33 @@ public class ThreadPool_Test {
__iThreadPool.putJob(new Job(iWorkAt, __iReceiver, iMessage));
}
+ private static void test_brokenImplementation() {
+ // The implementation of JavaThreadPoolFactory (rev. 1.2) and JobQueue
+ // (rev. 1.15) contains the following code as a race condition:
+ // 1 A call to JobQueue.acquire leads to
+ // _javaThreadPoolFactory.addJobQueue(this), leads to a
+ // _jobQueues.put call.
+ // 2 A call to JavaThreadPoolFactory.dispose creates an Enumeration;
+ // assume that, between calls to Enumeration.hasMoreElements and
+ // Enumeration.nextElement, JobQueue.release is called, leading to
+ // _javaThreadPoolFactory.removeJobQueue(this), leading to a
+ // _jobQueues.remove call; the use of the return value of the
+ // following Enumeration.nextElement results in a
+ // NullPointerException.
+ // (Detected once while running test_stress.)
+ Hashtable ht = new Hashtable();
+ String key = "key";
+ Object entry = new Object();
+ ht.put(key, entry);
+ Enumeration e = ht.elements();
+ if (!e.hasMoreElements()) {
+ throw new IllegalStateException();
+ }
+ ht.remove(key);
+ if (e.nextElement() != null) {
+ throw new IllegalStateException();
+ }
+ }
static boolean test_dispose(Vector vector, boolean silent) throws Throwable {
boolean passed = true;
@@ -735,6 +763,8 @@ public class ThreadPool_Test {
boolean passed = true;
boolean tmp_passed = false;
+ test_brokenImplementation();
+
tmp_passed = test_dispose(vector, false);
passed = passed && tmp_passed;
@@ -773,8 +803,3 @@ public class ThreadPool_Test {
System.err.println("---:" + vector.elementAt(i));
}
}
-
-
-
-
-