Invocation of System.exit()
terminates the JVM, consequently terminating all programs and threads running thereon. This can result in denial-of-service attacks. For example, a call to System.exit()
that is embedded in JSP code can cause a web server to terminate, preventing further service for users. Programs must prevent both inadvertent and malicious calls to System.exit()
. Additionally, programs should perform necessary clean-up actions when forcibly terminated (via ctrl + c
or the for example, by using the Windows Task Manager, POSIX kill
command, for exampleor other mechanism).
Noncompliant Code Example
...
Exceptions
Wiki Markup |
---|
*EXC09-EX1EX0:* It is permissible for a command line utility to call {{System.exit()}} or terminate prematurely; for example, when the required number of arguments are not input \[[Bloch 2008|AA. Bibliography#Bloch 08]\] and \[[ESA 2005|AA. Bibliography#ESA 05]\]. |
...