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 15:59:30 UTC
svn commit: r1644072 - in
/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index:
AbortingException.java DefaultIndexingChain.java
DocumentsWriterPerThread.java
Author: mikemccand
Date: Tue Dec 9 14:59:30 2014
New Revision: 1644072
URL: http://svn.apache.org/r1644072
Log:
LUCENE-5987: don't double-wrap AbortingException
Modified:
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/AbortingException.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/AbortingException.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/AbortingException.java?rev=1644072&r1=1644071&r2=1644072&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/AbortingException.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/AbortingException.java Tue Dec 9 14:59:30 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/trunk/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java?rev=1644072&r1=1644071&r2=1644072&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java Tue Dec 9 14:59:30 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);
}
}
@@ -322,7 +322,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);
}
// Add stored fields:
@@ -344,7 +344,7 @@ final class DefaultIndexingChain extends
storedFieldsWriter.writeField(fp.fieldInfo, field);
} catch (Throwable th) {
abort = true;
- throw new AbortingException(th);
+ throw AbortingException.wrap(th);
}
}
@@ -655,7 +655,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/trunk/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java?rev=1644072&r1=1644071&r2=1644072&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java Tue Dec 9 14:59:30 2014
@@ -456,7 +456,7 @@ class DocumentsWriterPerThread {
return fs;
} catch (Throwable th) {
abort();
- throw new AbortingException(th);
+ throw AbortingException.wrap(th);
}
}