From d9c6cb8b31449919a04063654230704e9315d2d0 Mon Sep 17 00:00:00 2001 From: Ryan Gustafson Date: Tue, 10 Jun 2008 05:56:05 +0000 Subject: [PATCH] Fixed bug 1988829 - Violation reported without source file name (actually a fix to ConsecutiveLiteralAppends) Allowed rootNode to be defaulted whenever 'concurrentCount' is more than 0. This will allow a VariableDeclaration to be identified as the rootNode, even if it is never referenced later. JUnit tests pass, I hope this doesn't have unintended consequences. git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.2.x@6184 51baf565-9d33-0410-a72c-fc3788e3496d --- pmd/etc/changelog.txt | 1 + .../pmd/rules/strings/ConsecutiveLiteralAppends.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pmd/etc/changelog.txt b/pmd/etc/changelog.txt index f3c2eed69d..b8b6ee5532 100644 --- a/pmd/etc/changelog.txt +++ b/pmd/etc/changelog.txt @@ -2,6 +2,7 @@ Fixes for exclude-pattern Updates to RuleChain to honor RuleSet exclude-pattern +Fixed bug 1988829 - Violation reported without source file name (actually a fix to ConsecutiveLiteralAppends) May 20, 2008 - 4.2.2: diff --git a/pmd/src/net/sourceforge/pmd/rules/strings/ConsecutiveLiteralAppends.java b/pmd/src/net/sourceforge/pmd/rules/strings/ConsecutiveLiteralAppends.java index fcf70e036b..7784881ae0 100644 --- a/pmd/src/net/sourceforge/pmd/rules/strings/ConsecutiveLiteralAppends.java +++ b/pmd/src/net/sourceforge/pmd/rules/strings/ConsecutiveLiteralAppends.java @@ -94,7 +94,7 @@ public class ConsecutiveLiteralAppends extends AbstractRule { Map> decls = node.getScope().getVariableDeclarations(); SimpleNode rootNode = null; // only want the constructor flagged if it's really containing strings - if (concurrentCount == 1) { + if (concurrentCount >= 1) { rootNode = node; } for (Map.Entry> entry: decls.entrySet()) {