apache / apache/lucene

Some tests catch Exceptions in separate threads and just print a stack trace - the test does not fail [LUCENE-2338]

Open
#3,414 11 comments 0 reactions 1 assignee Claimed by @uschindler View on GitHub
legacy-jira-fix-version:4.9 legacy-jira-fix-version:6.0 legacy-jira-priority:Major tool:build type:test
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Some tests catch Exceptions in separate threads and just print a stack trace - the test does not fail. The test should fail. Since #3350, the LuceneTestCase(J4) class installs an UncaughtExceptionHandler, so this type of catching and solely printing a Stack trace is a bad idea. Problem is, that the run() method of threads is not allowed to throw checked Exceptions.

Two possibilities:
- Catch checked Exceptions in the run() method and wrap into RuntimeException or call Assert.fail() instead
- Use Executors

---
Migrated from [LUCENE-2338](https://issues.apache.org/jira/browse/LUCENE-2338) by Uwe Schindler (@uschindler), updated May 09 2016
Linked issues:
- #3350

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.