ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glenn McAllister <gl...@somanetworks.com>
Subject Re: links in javadoc - proxy problem?
Date Mon, 30 Jul 2001 21:35:13 GMT
Matthew Inger wrote:

> how does one catch a System.exit in java 1.2 ???
> (this is intended for glenn)

As I've seen done by others (I haven't needed to do this yet personally):

SecurityManager oldSM = System.getSecurityManager();
System.setSecurityManager( new SecurityManager() {
                             public void checkExit(int status) {
                               // do what you want here... maybe throw
                               // a special exception
                             }

                             public void checkPermission(
java.security.Permission p ) {
                               // do something, maybe ignore...
                             }
                           });
try
{
    // Use whatever might call System.exit
}
finally
{
    System.setSecurityManager( oldSM );
}

See the docs for java.lang.SecurityManager for more details.

Glenn McAllister
SOMA Networks, Inc.


Mime
View raw message