You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2014/05/01 15:49:07 UTC

svn commit: r1591665 - /lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions2.java

Author: rmuir
Date: Thu May  1 13:49:06 2014
New Revision: 1591665

URL: http://svn.apache.org/r1591665
Log:
LUCENE-5635: properly shutdown IW

Modified:
    lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions2.java

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions2.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions2.java?rev=1591665&r1=1591664&r2=1591665&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions2.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions2.java Thu May  1 13:49:06 2014
@@ -19,7 +19,6 @@ package org.apache.lucene.index;
 
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
-import java.nio.charset.Charset;
 import java.util.Random;
 
 import org.apache.lucene.analysis.Analyzer;
@@ -42,6 +41,7 @@ import org.apache.lucene.util.Rethrow;
  * no index corruption is ever created
  */
 // TODO: not sure which fails are test bugs or real bugs yet...
+// reproduce with: ant test  -Dtestcase=TestIndexWriterExceptions2 -Dtests.method=testSimple -Dtests.seed=9D05AC6DFF3CC9A4 -Dtests.multiplier=10 -Dtests.locale=fi_FI -Dtests.timezone=Canada/Pacific -Dtests.file.encoding=ISO-8859-1
 // also sometimes when it fails, the exception-stream printing doesnt seem to be working yet
 // 
 @AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/LUCENE-5635")
@@ -115,7 +115,19 @@ public class TestIndexWriterExceptions2 
         }
       }
       
-      iw.close();
+      try {
+        iw.shutdown();
+      } catch (Exception e) {
+        if (e.getMessage() != null && e.getMessage().startsWith("Fake IOException")) {
+          System.out.println("\nTEST: got expected fake exc:" + e.getMessage());
+          e.printStackTrace(exceptionStream);
+          try {
+            iw.rollback();
+          } catch (Throwable t) {}
+        } else {
+          Rethrow.rethrow(e);
+        }
+      }
       dir.close();
     } catch (Throwable t) {
       System.out.println("Unexpected exception: dumping fake-exception-log:...");