[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ant-user
Subject:    Re: links in javadoc - proxy problem?
From:       Glenn McAllister <glenn () somanetworks ! com>
Date:       2001-07-30 21:35:13
[Download RAW message or body]

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.



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic