ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Glick <Jesse.Gl...@netbeans.com>
Subject Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Java.java
Date Wed, 19 Jul 2000 18:15:14 GMT
Conor MacNeill wrote:
> I have written a classloader for Ant. I'd appreciate any feedback on it.

Related, re. the no-fork mode of the Java task: note that if you are
willing to write some extra code, it is possible to trap System.exit
calls made from within the executed task and have them only terminate
that task, not the Ant VM. This is very useful for wrapping around
existing Java apps.

Basically, you need to install a security manager that checks exit
"permission"; also examine the calling stack to see what is happening,
and if inside the no-fork Java task, throw a special SecurityException
subclass with the intended exit code. The task impl can then catch this
exception and deal with it politely. Messy but it works. For example
see:

http://www.netbeans.org/source/browse/core/src/org/netbeans/core/execution/TopSecurityManager.java

-Jesse

-- 
Jesse Glick   <mailto:Jesse.Glick@netbeans.com>
NetBeans, Open APIs  <http://www.netbeans.org/>
tel (+4202) 3300-9161 Sun Micro x49161 Praha CR

Mime
View raw message