ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephane Bailliez <sbaill...@imediation.com>
Subject RE: Idea for future version
Date Fri, 13 Jul 2001 09:18:31 GMT
> -----Original Message-----
> From: François Lictevout [mailto:	

> I'm using Ant inside a java program, (for a task FTP), but there's a
> System.exit(0) in the main class.
> So my programs stops after the ant command.
> To solve the problem, I've downloaded the sources and deleted 
> the right
> line. It works now.
> However, I should do it for each new version.

Alternatively, you can change the security manager to avoid System.exit
calls when running Ant (or any class that might do a System.exit).
ie:

public class NullSecurityManager extends SecurityManager {
    public void checkExit(int status) {
    }
    public void checkPermission(java.security.Permission p) {
    }
}

SecurityManager oldsm = System.getSecurityManager();
System.setSecurityManager(new NullSecurityManager());
try {
	org.apache.tools.ant.Main.main(...);
} finally {
	System.setSecurityManager(oldsm);
}

Cheers,

-- 
 Stéphane Bailliez 
 Software Engineer, Paris - France 
 iMediation - http://www.imediation.com 
 Disclaimer: All the opinions expressed above are mine and not those from my
company. 



Mime
View raw message