[ 
https://issues.apache.org/jira/browse/LUCENE-4352?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

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 SecurityException

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.

THIS IS A HACK, BUT WORKS!
                
> only the test runner should be able to System.exit
> --------------------------------------------------
>
>                 Key: LUCENE-4352
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4352
>             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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to