You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2012/02/01 01:16:37 UTC
svn commit: r1238874 -
/lucene/dev/trunk/lucene/src/test-framework/java/org/apache/lucene/util/LuceneTestCase.java
Author: sarowe
Date: Wed Feb 1 00:16:37 2012
New Revision: 1238874
URL: http://svn.apache.org/viewvc?rev=1238874&view=rev
Log:
LUCENE-3743: LuceneTestCase's uncaught exceptions handler should check for AssumptionViolatedExceptions and then not trigger test failure
Modified:
lucene/dev/trunk/lucene/src/test-framework/java/org/apache/lucene/util/LuceneTestCase.java
Modified: lucene/dev/trunk/lucene/src/test-framework/java/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test-framework/java/org/apache/lucene/util/LuceneTestCase.java?rev=1238874&r1=1238873&r2=1238874&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test-framework/java/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/trunk/lucene/src/test-framework/java/org/apache/lucene/util/LuceneTestCase.java Wed Feb 1 00:16:37 2012
@@ -542,11 +542,33 @@ public abstract class LuceneTestCase ext
savedUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
public void uncaughtException(Thread t, Throwable e) {
- testsFailed = true;
- uncaughtExceptions.add(new UncaughtExceptionEntry(t, e));
- if (savedUncaughtExceptionHandler != null)
- savedUncaughtExceptionHandler.uncaughtException(t, e);
+ // org.junit.internal.AssumptionViolatedException in older releases
+ // org.junit.Assume.AssumptionViolatedException in recent ones
+ if (e.getClass().getName().endsWith("AssumptionViolatedException")) {
+ String where = "<unknown>";
+ for (StackTraceElement elem : e.getStackTrace()) {
+ if ( ! elem.getClassName().startsWith("org.junit")) {
+ where = elem.toString();
+ break;
+ }
+ }
+ if (e.getCause() instanceof _TestIgnoredException)
+ e = e.getCause();
+ System.err.print("NOTE: Assume failed at " + where + " (ignored):");
+ if (VERBOSE) {
+ System.err.println();
+ e.printStackTrace(System.err);
+ } else {
+ System.err.print(" ");
+ System.err.println(e.getMessage());
+ }
+ } else {
+ testsFailed = true;
+ uncaughtExceptions.add(new UncaughtExceptionEntry(t, e));
+ if (savedUncaughtExceptionHandler != null)
+ savedUncaughtExceptionHandler.uncaughtException(t, e);
}
+ }
});
savedBoolMaxClauseCount = BooleanQuery.getMaxClauseCount();