You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Aa...@vodafone.co.nz on 2003/06/22 23:08:49 UTC

System.exit in axis code

On line 106 of RPCParam.java, there is a System.exit(-1) in the static
initialiser.  I am not yet certain whether or not it is related, but my web
service client has begun exiting every time it tries to make a RPC call.
The only way the JVM could exit here is via a System.exit() or a JVM crash,
since I have surrounded this block with a catch Throwable and write a log
message (which does not appear).

Regardless of whether or not this piece of code is the culprit, I hardly
need to point out that putting System.exit in server-side code is _always_
a terrible idea.  Bearing in mind that you are sharing your runtime
environment with any number of other apps, you are basically saying that if
your code won't work, no-one else's code will either.

So, /please/, replace this System.exit() with an appropriate exception and
/please/ do not put in any more System.exit()'s outside of a command-line
main method!

Here is a quick hack fix for RPCParam.java.  There seems to be a similar
problem with WSDL2.java, but I have yet to investigate that properly.

(See attached file: RPCParam.java)

Cheers

ADK


--------------------------------------------

There is no magic.
-----------------------------------------------------------------------------------------------
Have you seen our website?.... http://www.vodafone.co.nz

CAUTION: This correspondence is confidential and intended for the named recipient(s) only.
If you are not the named recipient and receive this correspondence in error, you must not copy,
distribute or take any action in reliance on it and you should delete it from your system and
notify the sender immediately.  Thank you.

Unless otherwise stated, any views or opinions expressed are solely those of the author and do
not represent those of Vodafone New Zealand Limited.

Vodafone New Zealand Limited
21 Pitt Street, Private Bag 92161, Auckland, 1020, New Zealand
Telephone + 64 9 357 5100
Facsimile + 64 9 377 0962

Re: System.exit in axis code

Posted by Steve Loughran <st...@iseran.com>.
Aaron.Knauf@vodafone.co.nz wrote:
> On line 106 of RPCParam.java, there is a System.exit(-1) in the static
> initialiser.  I am not yet certain whether or not it is related, but my web
> service client has begun exiting every time it tries to make a RPC call.
> The only way the JVM could exit here is via a System.exit() or a JVM crash,
> since I have surrounded this block with a catch Throwable and write a log
> message (which does not appear).

uh oh

> 
> Regardless of whether or not this piece of code is the culprit, I hardly
> need to point out that putting System.exit in server-side code is _always_
> a terrible idea.  Bearing in mind that you are sharing your runtime
> environment with any number of other apps, you are basically saying that if
> your code won't work, no-one else's code will either.

agreed, though anything running under a security manager gets to filter 
out the exit calls.

> 
> So, /please/, replace this System.exit() with an appropriate exception and
> /please/ do not put in any more System.exit()'s outside of a command-line
> main method!
> 
> Here is a quick hack fix for RPCParam.java.  There seems to be a similar
> problem with WSDL2.java, but I have yet to investigate that properly.

Fix applied. In Java 1.4 I'd chain the exception, but cannot do that 
with code that has to run on 1.3 too.

-steve