lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (JIRA)" <>
Subject [jira] [Updated] (LUCENE-4352) only the test runner should be able to System.exit
Date Mon, 03 Sep 2012 17:50:07 GMT


Uwe Schindler updated LUCENE-4352:

    Attachment: LUCENE-4352.patch

Here is a quick patch thet prevents System.exit() with a dirty hack:

- This installs a subclass of Java's original java.lang.SecurityManager, so the tests.policy
file is still taken into account (see common-build.xml)
- The method checkExit(int) was overridden to:

# create a SecurityException, but don't throw (just to get the stack trace).
# Inspect stack trace and saerch for System.exit (to walk over JVM-internal things)
# The *next* element in the stack trace (important, no gaps inbetween) after System.exit()
must be SlaveMain.main() from Junit4's ANT runner. If this stack element is found, checkExit()
delegates to superclass (which will always pass without SecurityException)
# If no valid stack trace element is found, checkExit() will finally throw the already instantiated

This patch works for me, but I need a list of all "valid" exit points with stack traces that
can occur in Dawid's code.

> only the test runner should be able to System.exit
> --------------------------------------------------
>                 Key: LUCENE-4352
>                 URL:
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Robert Muir
>         Attachments: LUCENE-4352.patch
> All others should get SecurityException

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message