From 7275c9f0bea4247a4b3adfc1c4e14e9af68fd1bb Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Mon, 26 Sep 2011 19:41:32 +0000 Subject: [PATCH] Applied patch 3013807: DoNotCallSystemExit through Runtime. Thanks to Steven Christou. git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7356 51baf565-9d33-0410-a72c-fc3788e3496d --- pmd/etc/changelog.txt | 1 + .../java/rule/j2ee/xml/DoNotCallSystemExit.xml | 14 ++++++++++++++ pmd/rulesets/java/j2ee.xml | 13 ++++++++++--- pmd/xdocs/credits.xml | 1 + 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/pmd/etc/changelog.txt b/pmd/etc/changelog.txt index f61639ce39..f4e1982f85 100644 --- a/pmd/etc/changelog.txt +++ b/pmd/etc/changelog.txt @@ -343,6 +343,7 @@ Fix false positive on CastExpressions for UselessParentheses Fix false positive where StringBuffer.setLength(0) was using default constructor size of 16, instead of actual constructor size. Fix false negative for non-primitive types for VariableNamingConventions, also expanded scope to local and method/constructors, and enhanced customization options to choose between members/locals/parameters (all checked by default) Improve TooManyMethods rule - thanks to a patch from Riku Nykanen +Improve DoNotCallSystemExit - thanks to a patch from Steven Christou Correct -benchmark reporting of Rule visits via the RuleChain Creating an Empty Code Ruleset and moved the following rules from Basic ruleset: * Empty Code Rules diff --git a/pmd/regress/test/net/sourceforge/pmd/lang/java/rule/j2ee/xml/DoNotCallSystemExit.xml b/pmd/regress/test/net/sourceforge/pmd/lang/java/rule/j2ee/xml/DoNotCallSystemExit.xml index 0fcab6e245..276edb0538 100644 --- a/pmd/regress/test/net/sourceforge/pmd/lang/java/rule/j2ee/xml/DoNotCallSystemExit.xml +++ b/pmd/regress/test/net/sourceforge/pmd/lang/java/rule/j2ee/xml/DoNotCallSystemExit.xml @@ -25,6 +25,20 @@ public class SystemCall { // OK application.exit(0); } +} + ]]> + + + + 1 + diff --git a/pmd/rulesets/java/j2ee.xml b/pmd/rulesets/java/j2ee.xml index bc3d6e138e..b72936fd79 100644 --- a/pmd/rulesets/java/j2ee.xml +++ b/pmd/rulesets/java/j2ee.xml @@ -250,20 +250,27 @@ Remote Interface of a Session EJB should not have a suffix. externalInfoUrl="http://pmd.sourceforge.net/rules/java/j2ee.html#DoNotCallSystemExit"> Web applications should not call System.exit(), since only the web container or the -application server should stop the JVM. +application server should stop the JVM. This rule also checks for the equivalent call Runtime.getRuntime().exit(). 3 diff --git a/pmd/xdocs/credits.xml b/pmd/xdocs/credits.xml index e3de961fa4..dcea652a78 100644 --- a/pmd/xdocs/credits.xml +++ b/pmd/xdocs/credits.xml @@ -322,6 +322,7 @@
  • Andreas Dangel - GodClass and LawOfDemeter rules, several bugfixes and cleanup
  • Riku Nykanen - patch improving TooManyMethods rule
  • Tammo van Lessen - new rule GuardDebugLogging for Jakarta Commons Logging ruleset.
  • +
  • Steven Christou - patch improving DoNotCallSystemExit rule