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

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

Author: mikemccand
Date: Fri Sep  5 13:13:44 2014
New Revision: 1622693

URL: http://svn.apache.org/r1622693
Log:
test: list index files on failure

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

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=1622693&r1=1622692&r2=1622693&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java Fri Sep  5 13:13:44 2014
@@ -1166,6 +1166,7 @@ public class TestIndexWriter extends Luc
         } catch (Throwable t) {
           log.println("thread " + id + " FAILED; unexpected exception");
           t.printStackTrace(log);
+          listIndexFiles(log, dir);
           failed = true;
           break;
         }
@@ -1194,6 +1195,7 @@ public class TestIndexWriter extends Luc
           failed = true;
           log.println("thread " + id + ": CheckIndex FAILED: unexpected exception");
           e.printStackTrace(log);
+          listIndexFiles(log, dir);
         }
         try {
           IndexReader r = DirectoryReader.open(dir);
@@ -1203,6 +1205,7 @@ public class TestIndexWriter extends Luc
           failed = true;
           log.println("thread " + id + ": DirectoryReader.open FAILED: unexpected exception");
           e.printStackTrace(log);
+          listIndexFiles(log, dir);
         }
       }
       try {
@@ -1218,6 +1221,16 @@ public class TestIndexWriter extends Luc
         throw new RuntimeException("thread " + id, e);
       }
     }
+
+    private void listIndexFiles(PrintStream log, Directory dir) {
+      try {
+        log.println("index files: " + Arrays.toString(dir.listAll()));
+      } catch (IOException ioe) {
+        // Suppress
+        log.println("failed to index files:");
+        ioe.printStackTrace(log);
+      }
+    }
   }
 
   public void testThreadInterruptDeadlock() throws Exception {
@@ -1730,7 +1743,6 @@ public class TestIndexWriter extends Luc
     Arrays.fill(chars, 'x');
     Document doc = new Document();
     final String bigTerm = new String(chars);
-    final BytesRef bigTermBytesRef = new BytesRef(bigTerm);
 
     // This contents produces a too-long term:
     String contents = "abc xyz x" + bigTerm + " another term";