From 0496cc8fc546dc5bc8c19697431d9d43202e58e7 Mon Sep 17 00:00:00 2001 From: Romain Pelisse Date: Thu, 29 Sep 2011 14:52:46 +0000 Subject: [PATCH] Fix patch 3130615: fix xpath rule to consider the correct if-condition. git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.3.x@7362 51baf565-9d33-0410-a72c-fc3788e3496d --- .../xml/GuardDebugLogging.xml | 19 +++++++++++++++++++ pmd/rulesets/logging-jakarta-commons.xml | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/pmd/regress/test/net/sourceforge/pmd/rules/loggingjakartacommons/xml/GuardDebugLogging.xml b/pmd/regress/test/net/sourceforge/pmd/rules/loggingjakartacommons/xml/GuardDebugLogging.xml index 60195704bc..65e3f3a4f1 100644 --- a/pmd/regress/test/net/sourceforge/pmd/rules/loggingjakartacommons/xml/GuardDebugLogging.xml +++ b/pmd/regress/test/net/sourceforge/pmd/rules/loggingjakartacommons/xml/GuardDebugLogging.xml @@ -49,6 +49,25 @@ public class Test { __log.debug("bla" + "",e ); } } +} + ]]> + + + + 1 + diff --git a/pmd/rulesets/logging-jakarta-commons.xml b/pmd/rulesets/logging-jakarta-commons.xml index 14afbf300f..0914f09d18 100644 --- a/pmd/rulesets/logging-jakarta-commons.xml +++ b/pmd/rulesets/logging-jakarta-commons.xml @@ -103,7 +103,7 @@ around, with the restriction that the logger needs to be passed into the constru 0 and count(ancestor::IfStatement/descendant::PrimaryExpression[ends-with(descendant::PrimaryPrefix/Name/@Image, 'isDebugEnabled')]) = 0] + //PrimaryPrefix[ends-with(Name/@Image, '.debug') and count(../descendant::AdditiveExpression) > 0 and count(ancestor::IfStatement/Expression/descendant::PrimaryExpression[ends-with(descendant::PrimaryPrefix/Name/@Image, 'isDebugEnabled')]) = 0] ]]>