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/12/09 16:02:04 UTC

svn commit: r1644075 - in /lucene/dev/branches/branch_5x: ./ lucene/ lucene/core/ lucene/core/src/java/org/apache/lucene/index/

Author: mikemccand
Date: Tue Dec  9 15:02:04 2014
New Revision: 1644075

URL: http://svn.apache.org/r1644075
Log:
LUCENE-5987: don't double-wrap AbortingException

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/lucene/   (props changed)
    lucene/dev/branches/branch_5x/lucene/core/   (props changed)
    lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/AbortingException.java
    lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java
    lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java

Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/AbortingException.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/AbortingException.java?rev=1644075&r1=1644074&r2=1644075&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/AbortingException.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/AbortingException.java Tue Dec  9 15:02:04 2014
@@ -21,7 +21,16 @@ package org.apache.lucene.index;
  *  lose previously indexed documents.  When this happens, the {@link IndexWriter} is forcefully 
  *  closed, using {@link IndexWriter#rollback}). */
 class AbortingException extends Exception {
-  AbortingException(Throwable cause) {
+  private AbortingException(Throwable cause) {
     super(cause);
+    assert cause instanceof AbortingException == false;
+  }
+
+  public static AbortingException wrap(Throwable t) {
+    if (t instanceof AbortingException) {
+      return (AbortingException) t;
+    } else {
+      return new AbortingException(t);
+    }
   }
 }

Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java?rev=1644075&r1=1644074&r2=1644075&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java Tue Dec  9 15:02:04 2014
@@ -258,7 +258,7 @@ final class DefaultIndexingChain extends
       initStoredFieldsWriter();
       storedFieldsWriter.startDocument();
     } catch (Throwable th) {
-      throw new AbortingException(th);
+      throw AbortingException.wrap(th);
     }
     lastStoredDocID++;
   }
@@ -269,7 +269,7 @@ final class DefaultIndexingChain extends
     try {
       storedFieldsWriter.finishDocument();
     } catch (Throwable th) {
-      throw new AbortingException(th);
+      throw AbortingException.wrap(th);
     }
   }
 
@@ -317,7 +317,7 @@ final class DefaultIndexingChain extends
     } catch (Throwable th) {
       // Must abort, on the possibility that on-disk term
       // vectors are now corrupt:
-      throw new AbortingException(th);
+      throw AbortingException.wrap(th);
     }
   }
   
@@ -360,7 +360,7 @@ final class DefaultIndexingChain extends
         try {
           storedFieldsWriter.writeField(fp.fieldInfo, field);
         } catch (Throwable th) {
-          throw new AbortingException(th);
+          throw AbortingException.wrap(th);
         }
       }
     }
@@ -666,7 +666,7 @@ final class DefaultIndexingChain extends
             // Document will be deleted above:
             throw new IllegalArgumentException(msg, e);
           } catch (Throwable th) {
-            throw new AbortingException(th);
+            throw AbortingException.wrap(th);
           }
         }
 

Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java?rev=1644075&r1=1644074&r2=1644075&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java Tue Dec  9 15:02:04 2014
@@ -455,7 +455,7 @@ class DocumentsWriterPerThread {
       return fs;
     } catch (Throwable th) {
       abort();
-      throw new AbortingException(th);
+      throw AbortingException.wrap(th);
     }
   }