From a88440bea9b9ef44e1dba4decb20cf2f5356747c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Fri, 24 Apr 2020 16:44:52 +0200 Subject: [PATCH 1/2] Fix #2437 --- .../resources/category/java/bestpractices.xml | 8 +- .../xml/AvoidPrintStackTrace.xml | 96 +++++++++++++++---- 2 files changed, 80 insertions(+), 24 deletions(-) diff --git a/pmd-java/src/main/resources/category/java/bestpractices.xml b/pmd-java/src/main/resources/category/java/bestpractices.xml index 3264cd40a3..404d279708 100644 --- a/pmd-java/src/main/resources/category/java/bestpractices.xml +++ b/pmd-java/src/main/resources/category/java/bestpractices.xml @@ -185,9 +185,11 @@ Avoid printStackTrace(); use a logger call instead. diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/AvoidPrintStackTrace.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/AvoidPrintStackTrace.xml index 6e1173cdc4..625d70fb57 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/AvoidPrintStackTrace.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/AvoidPrintStackTrace.xml @@ -1,14 +1,12 @@ - - - - 1 - + + simple failure + 1 + 4 + - - - - 0 - + + + + ok + 0 + - - + ]]> + + + + pos in call chain #2437 + 1 + + + + + neg, not a real call + 0 + + + + + neg, not a real call 2 + 0 + + + + + neg, not a real call 3 + 0 + + + + \ No newline at end of file From db88d03879df482c4787522c31fd1101794c292d Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 22 May 2020 20:12:03 +0200 Subject: [PATCH 2/2] [doc] Update release notes, fixes #2437 --- docs/pages/release_notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 221005b2e7..cae2119ed6 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -83,6 +83,7 @@ See [the documentation and example](https://pmd.github.io/latest/pmd_userdocs_re * [#2378](https://github.com/pmd/pmd/issues/2378): \[java] AbstractJUnitRule has bad performance on large code bases * java-bestpractices * [#2398](https://github.com/pmd/pmd/issues/2398): \[java] AbstractClassWithoutAbstractMethod false negative with inner abstract classes + * [#2437](https://github.com/pmd/pmd/issues/2437): \[java] AvoidPrintStackTrace can't detect the case e.getCause().printStackTrace() * java-codestyle * [#1164](https://github.com/pmd/pmd/issues/1164): \[java] ClassNamingConventions suggests to add Util for class containing only static constants * [#1723](https://github.com/pmd/pmd/issues/1723): \[java] UseDiamondOperator false-positive inside lambda