Grant, I'm interested in implementing my own custom SecurityManager to catch the exception then generated by System.exit(). Can you point me to any sources about learning how to do this?
-----Original Message----- From: Grant Echols (JanusLogix) [mailto:gechols@;januslogix.com] Sent: Thursday, October 17, 2002 3:57 PM To: [EMAIL PROTECTED] Subject: Re: How to use the Java2WSDL class inside a java program Steve, I couldn't agree more! - main() should do a System.exit() so that its results can be tested. However, the System.exit() isn't coming from main(), its being called from inside the run(String[] args) method. If this had only done a return with a result code then the main() could easily have done the System.exit() with the return code and we could be using the run method. This would give me a method I could call from inside my tool (as others are also trying to do) and yet would still return the results to Ant, batch file, whatever. I'm sorry this was taken as just complaining. I'd prefer that it generated some action to improve the code that appears to be biting more than just me. If this isn't the open source way then I admit I'm a newbie and just trying to get my job done. Thanks, Grant ----- Original Message ----- From: "Steve Loughran" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 17, 2002 11:04 AM Subject: Re: How to use the Java2WSDL class inside a java program > > ----- Original Message ----- > From: "Grant Echols (JanusLogix)" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, October 17, 2002 8:24 AM > Subject: Re: How to use the Java2WSDL class inside a java program > > > > That problem has bitten me too. We want to do a dynamic publish which we > try > > to use the Java2WSDL and WSDL2Java so we get a deploy.wsdd file. We found > a > > couple of things that seemed to help. The biggest is we load a custom > > SecurityManager just before running the .main() methods. The primary > > objective of the custom SecurityManager is to reject any attempts at > running > > System.exit(). What you'll get is an exception thrown when the > System.exit() > > method gets invoked. > > > > To clean up the exception caused by the SecurityManager we wrote a > > PrintStream that swallows the exception. This enabled us to essentially > call > > the two utilities inside our JVM without having them shut us down. > > > > Note: this is a hack and the real solution would be for Axis to stop > making > > the System.exit() call. Instead it should be doing a return...but I don't > > know who's listening or if its of significant value so my hack will stay > in > > place for a while. > > Calling system.exit in a main() app is *exactly* what it should be doing, so > your makefiles and shell scripts can see if it worked. > > The solution is not to use a wrapper class like the main entry point, or > even the ant task, but the stuff one level down that does the work. I.e. > the solution in the open source world is to look at the source files and > find out what they do, rather than complain about apparent deficiencies in > the interface. > > > -steve > >
