lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From busc...@apache.org
Subject svn commit: r659326 - /lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderReopen.java
Date Fri, 23 May 2008 00:20:33 GMT
Author: buschmi
Date: Thu May 22 17:20:32 2008
New Revision: 659326

URL: http://svn.apache.org/viewvc?rev=659326&view=rev
Log:
Fixed TestIndexReaderReopen.java to fail when a thread hits an error in testThreadSafety().

Modified:
    lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderReopen.java

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderReopen.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderReopen.java?rev=659326&r1=659325&r2=659326&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderReopen.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderReopen.java Thu May
22 17:20:32 2008
@@ -41,10 +41,11 @@
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.FSDirectory;
 import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.LuceneTestCase;
 
 import junit.framework.TestCase;
 
-public class TestIndexReaderReopen extends TestCase {
+public class TestIndexReaderReopen extends LuceneTestCase {
     
   private File indexDir;
 
@@ -753,8 +754,9 @@
       if (threads[i] != null) {
         try {
           threads[i].join();
-          if (threads[i].exception != null) {
-            throw threads[i].exception;
+          if (threads[i].error != null) {
+            String msg = "Error occurred in thread " + threads[i].getId() + ":\n" + threads[i].error.getMessage();
+            fail(msg);
           }
         } catch (InterruptedException e) {}
       }
@@ -799,7 +801,7 @@
   
   private static class ReaderThread extends Thread {
     private ReaderThreadTask task;
-    private Exception exception;
+    private Throwable error;
     
     
     ReaderThread(ReaderThreadTask task) {
@@ -813,8 +815,8 @@
     public void run() {
       try {
         this.task.run();
-      } catch (Exception e) {
-        this.exception = e;
+      } catch (Throwable r) {
+        this.error = r;
       }
     }
   }



Mime
View raw message