ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Blackard, Robert" <robert.black...@tgslc.org>
Subject RE: Build and Confiuration Managment with Ant... a.k.a. running A nt _ from_ JSP/Servlet
Date Thu, 16 Aug 2001 14:57:23 GMT
I'm not the first, and won't be the last, to read the Installating Ant and
Using Ant documentation that didn't find this behavior documented, so how
else am I supposed to know the consequences you discuss below?

In your conclusion, you are quite correct that I can subclass main and, to
be honest, I didn't think to so that's my own fault - I double checked and
Main.Main() is protected, not private.  Also, I think subclassing Main is
much more useful that adding a custom security class and would suggest that
it be made the reccomended option.

Truely, many thanks for all your constructive help.  I didn't think before
starting the philisophical debate over how Java should be used.  As you
said, there are lots of systems that do this, and my oppinion about whether
or not such behavior is valid or a violation of some esoteric semantic of
the language isn't going to make the universe a better place.  For me, the
important thing is that I have a complete and acceptable solution to the
problem, which you have provided.  You can have my soap-box back :-)


> -----Original Message-----
> From: Stephane Bailliez [mailto:sbailliez@imediation.com]
> Sent: Thursday, August 16, 2001 9:37 AM
> To: ant-user@jakarta.apache.org
> Subject: RE: Build and Confiuration Managment with Ant... 
> a.k.a. running
> A nt _ from_ JSP/Servlet
> 
> 
> > -----Original Message-----
> > From: Blackard, Robert [mailto:robert.blackard@tgslc.org]
> > 
> 
> > I must disagree with your comment that System.exit() calls 
> > are 'somewhat
> > normal'... yes it might be commonly done, but I don't beleive 
> > it should be
> > and according to the Java specifications it is by no means normal.
> 
> If you are invoking it from the command line it is perfectly 
> normal to me.
> It is of course not normal to splattered your source code 
> with System.exit
> in every place. Javadoc is not different, Xalan command line as well.
> 
> System.exit are only in the command line method.
> 
> > The Fathers of Java intentionally and implicitly defined the 
> > main() method
> > to be void.  This wasn't something they just pulled out of 
> > the air, nor was
> > it something that they did because it's how every other 
> > system did it -
> > quite the contrary, this is a departure from the standard 
> > practice and was a
> > very concious decision on their part.
> 
> [...]
> A main method is supposed to give you an entry point from the 
> command line,
> certainly not from within an application.
> 
> If you decide to run it this way, this is fine. But you 
> should know what you
> are doing and the consequences between something done to 
> return status code
> indicating error.
> 
> Once again main is for command line.
> 
> > That said, the standard argument for using a System.exit() 
> is that it
> > support the use of scripting with tools like a Unix shell or Perl.
> > Certainly, providing an exit code is a means to support this, 
> > but again, not
> > all operating systems support exit codes.
> 
> All operating system do not have a file system.
> All operating system do not have environment variables.
> All operating system do not have a JVM.
> ....
> 
> [...]
> > Finally, since I don't expect the definition of
> > org.apache.tools.ant.Main.main() to change since it's out 
> > there in so many
> > places, may I suggest alternatively that you implement the
> > org.apache.tools.ant.Main.run() method that throws 
> > exceptions, and modify
> > org.apache.tools.ant.Main.main() to call 
> > org.apache.tools.ant.Main.run() and
> > generate System.exit(0) if no exception is thrown and 
> > System.exit(1) if an
> > exception is thrown.  That way, those of us that wish to 
> use Ant from
> > another Java process can do so without overriding the 
> > Security Manager.
> 
> It's already there.
> Subclass Main and run it via runBuild if you don't want to 
> retype code to
> setup Ant.
> 
> You have the choice here...I don't understand what the problem is.
> 
> -- 
>  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