Lucene - Core
  1. Lucene - Core
  2. LUCENE-3857

exceptions from other threads in beforeclass/etc do not fail the test

    Details

    • Type: Task Task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6, 4.0-ALPHA
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      Lots of tests create indexes in beforeClass methods, but if an exception is thrown from another thread
      it won't fail the test... e.g. this test passes:

      public class TestExc extends LuceneTestCase {
        @BeforeClass
        public static void beforeClass() {
          new Thread() {
            public void run() {
              throw new RuntimeException("boo!");
            }  
          }.start();
        }
        
        public void test() { }
      }
      

      this is because the uncaught exception handler is in setup/teardown

        Activity

        Hide
        Dawid Weiss added a comment -

        A patch against the trunk extracting uncaught exceptions management to a class and test rule.

        There are tiny differences to previous implementations – the exception is logged to stderr at the time it is thrown and parent handler is NOT invoked (because it'd cause double detection and the default handler's job is only to dump the stack).

        I will commit immediately?

        Show
        Dawid Weiss added a comment - A patch against the trunk extracting uncaught exceptions management to a class and test rule. There are tiny differences to previous implementations – the exception is logged to stderr at the time it is thrown and parent handler is NOT invoked (because it'd cause double detection and the default handler's job is only to dump the stack). I will commit immediately?
        Hide
        Dawid Weiss added a comment -

        This is solved by 3808 but I can also fix it on the trunk if you need a temporary fix.

        Show
        Dawid Weiss added a comment - This is solved by 3808 but I can also fix it on the trunk if you need a temporary fix.

          People

          • Assignee:
            Dawid Weiss
            Reporter:
            Robert Muir
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development