+1 for a utility method here... Dawid's Rethrower class is sneaky :) Doesn't require wrapping as RuntimeException ever...
But either approach is better than always wrapping in RuntimeException. We need this in IOUtils methods too. Mike McCandless http://blog.mikemccandless.com On Thu, Mar 29, 2012 at 11:50 AM, Uwe Schindler <u...@thetaphi.de> wrote: > We should maybe add a utility method in lucene.util package (core), because > this is also often needed in Lucene core. Lots of code simply wraps needless > by RuntimeException. A good rethrow method should check with 2 instanceof > checks the rethrowable Exceptions and otherwise wrap with RuntimeEx: > > static void rethrowUnchecked(Throwable t) { > if (t instanceof RuntimeException) > throw (RuntimeException) t; > if (t instanceof Error) > throw (Error) t; > throw new RuntimeException(t); > } > > These 2 instanceof checks catch all unchecked Exceptions, often the "Error" > case is missing. > ----- > Uwe Schindler > H.-H.-Meier-Allee 63, D-28213 Bremen > http://www.thetaphi.de > eMail: u...@thetaphi.de > > >> -----Original Message----- >> From: Robert Muir [mailto:rcm...@gmail.com] >> Sent: Thursday, March 29, 2012 5:26 PM >> To: dev@lucene.apache.org >> Subject: Re: [JENKINS] Lucene-Solr-tests-only-3.x - Build # 12905 - Failure >> >> oh, i think i know the problem. >> >> the 'help' basetokenstream gives here, that steve mentions, causes the >> problem. >> I bet it catches and rethrows Throwable or something wrapped in a >> RuntimeException? >> But if its an assumptionViolatedException... it should ensure it doesnt wrap >> it! >> >> On Thu, Mar 29, 2012 at 11:21 AM, Dawid Weiss >> <dawid.we...@cs.put.poznan.pl> wrote: >> > This looks like a re-thrown (wrapped) failed assumption. Don't know >> > the logic of that test -- maybe it should be an assumption? >> > >> > Dawid >> > >> > Caused by: org.junit.internal.AssumptionViolatedException: failed >> > assumption: Test data cannot contain '\uFFFF' (Lucene 3.x only) >> > at >> > org.apache.lucene.analysis.MockTokenizer.readCodePoint(MockTokenizer.j >> > ava:136) >> > at >> > org.apache.lucene.analysis.MockTokenizer.incrementToken(MockTokenizer. >> > java:111) >> > at >> > org.apache.lucene.analysis.BaseTokenStreamTestCase.checkAnalysisConsis >> > tency(BaseTokenStreamTestCase.java:427) >> > at >> > >> org.apache.lucene.analysis.BaseTokenStreamTestCase.checkRandomData(Bas >> > eTokenStreamTestCase.java:395) >> > >> > Dawid >> > >> > On Thu, Mar 29, 2012 at 5:06 PM, Robert Muir <rcm...@gmail.com> wrote: >> >> I think this could be bogus? Looks from a stacktrace its failing on >> >> an >> >> assume() from another thread? >> >> >> >> You fixed this... but maybe we lost it in some cleanup? >> >> >> >> On Thu, Mar 29, 2012 at 11:02 AM, Steven A Rowe <sar...@syr.edu> >> wrote: >> >>> I can reproduce this locally - I'm >> digging. BaseTokenStreamTestCase.checkRandomData() prints to standard >> error: >> >>> >> >>> [junit] TEST FAIL: useCharFilter=true text='\"ÿ' >> >>> >> >>> which is fantastic - very easy to see where to focus the search for >> problems. >> >>> >> >>> Thanks Robert, Mike, and Dawid for all your work beefing up test >> >>> facilities. >> >>> >> >>> Steve >> >>> >> >>> -----Original Message----- >> >>> From: Apache Jenkins Server [mailto:jenk...@builds.apache.org] >> >>> Sent: Thursday, March 29, 2012 9:18 AM >> >>> To: dev@lucene.apache.org >> >>> Subject: [JENKINS] Lucene-Solr-tests-only-3.x - Build # 12905 - >> >>> Failure >> >>> >> >>> Build: >> >>> https://builds.apache.org/job/Lucene-Solr-tests-only-3.x/12905/ >> >>> >> >>> 1 tests failed. >> >>> REGRESSION: >> >>> org.apache.lucene.analysis.charfilter.HTMLStripCharFilterTest.testRa >> >>> ndom >> >>> >> >>> Error Message: >> >>> Uncaught exception by thread: Thread[Thread-8,5,] >> >>> >> >>> Stack Trace: >> >>> org.apache.lucene.util.UncaughtExceptionsRule$UncaughtExceptionsInBa >> >>> ckgroundThread: Uncaught exception by thread: Thread[Thread-8,5,] >> >>> at >> >>> org.apache.lucene.util.UncaughtExceptionsRule$1.evaluate(UncaughtExc >> >>> eptionsRule.java:83) >> >>> at >> >>> >> org.apache.lucene.util.LuceneTestCase$SaveThreadAndTestNameRule$1.ev >> >>> aluate(LuceneTestCase.java:508) >> >>> at org.junit.rules.RunRules.evaluate(RunRules.java:18) >> >>> at >> >>> org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) >> >>> at >> >>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRu >> >>> nner.java:68) >> >>> at >> >>> org.apache.lucene.util.LuceneTestCaseRunner.runChild(LuceneTestCaseR >> >>> unner.java:146) >> >>> at >> >>> org.apache.lucene.util.LuceneTestCaseRunner.runChild(LuceneTestCaseR >> >>> unner.java:50) >> >>> at >> >>> org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) >> >>> at >> >>> org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) >> >>> at >> >>> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) >> >>> at >> >>> org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) >> >>> at >> >>> org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) >> >>> at >> >>> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores >> >>> .java:28) >> >>> at >> >>> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.j >> >>> ava:30) >> >>> at >> >>> org.apache.lucene.util.UncaughtExceptionsRule$1.evaluate(UncaughtExc >> >>> eptionsRule.java:74) >> >>> at >> >>> org.apache.lucene.util.StoreClassNameRule$1.evaluate(StoreClassNameR >> >>> ule.java:36) >> >>> at >> >>> org.apache.lucene.util.SystemPropertiesInvariantRule$1.evaluate(Syst >> >>> emPropertiesInvariantRule.java:67) >> >>> at org.junit.rules.RunRules.evaluate(RunRules.java:18) >> >>> at org.junit.runners.ParentRunner.run(ParentRunner.java:300) >> >>> at >> >>> junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39) >> >>> at >> >>> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUn >> >>> itTestRunner.java:420) >> >>> at >> >>> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch( >> >>> JUnitTestRunner.java:911) >> >>> at >> >>> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JU >> >>> nitTestRunner.java:743) Caused by: java.lang.RuntimeException: >> >>> org.junit.internal.AssumptionViolatedException: failed assumption: >> >>> Test data cannot contain '\uFFFF' (Lucene 3.x only) >> >>> at >> >>> >> org.apache.lucene.analysis.BaseTokenStreamTestCase.checkRandomData(B >> >>> aseTokenStreamTestCase.java:398) >> >>> at >> >>> org.apache.lucene.analysis.BaseTokenStreamTestCase.access$000(BaseTo >> >>> kenStreamTestCase.java:50) >> >>> at >> >>> org.apache.lucene.analysis.BaseTokenStreamTestCase$AnalysisThread.ru >> >>> n(BaseTokenStreamTestCase.java:336) >> >>> Caused by: org.junit.internal.AssumptionViolatedException: failed >> >>> assumption: Test data cannot contain '\uFFFF' (Lucene 3.x only) >> >>> at >> >>> org.apache.lucene.analysis.MockTokenizer.readCodePoint(MockTokenizer >> >>> .java:136) >> >>> at >> >>> org.apache.lucene.analysis.MockTokenizer.incrementToken(MockTokenize >> >>> r.java:111) >> >>> at >> >>> org.apache.lucene.analysis.BaseTokenStreamTestCase.checkAnalysisCons >> >>> istency(BaseTokenStreamTestCase.java:427) >> >>> at >> >>> >> org.apache.lucene.analysis.BaseTokenStreamTestCase.checkRandomData(B >> >>> aseTokenStreamTestCase.java:395) >> >>> ... 2 more >> >>> >> >>> >> >>> >> >>> >> >>> Build Log (for compile errors): >> >>> [...truncated 11422 lines...] >> >>> >> >>> >> >> >> >> >> >> >> >> -- >> >> lucidimagination.com >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For >> >> additional commands, e-mail: dev-h...@lucene.apache.org >> >> >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For >> > additional commands, e-mail: dev-h...@lucene.apache.org >> > >> >> >> >> -- >> lucidimagination.com >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional >> commands, e-mail: dev-h...@lucene.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org > For additional commands, e-mail: dev-h...@lucene.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org