diff --git a/pmd/regress/test/net/sourceforge/pmd/RuleSetFactoryTest.java b/pmd/regress/test/net/sourceforge/pmd/RuleSetFactoryTest.java
index 01addab111..204771ab35 100644
--- a/pmd/regress/test/net/sourceforge/pmd/RuleSetFactoryTest.java
+++ b/pmd/regress/test/net/sourceforge/pmd/RuleSetFactoryTest.java
@@ -140,16 +140,27 @@ public class RuleSetFactoryTest extends TestCase {
assertEquals("TestMessageOverride", r.getMessage());
}
+ public void testOverrideMessageOneElem() {
+ Rule r = loadFirstRule(REF_OVERRIDE_ORIGINAL_NAME_ONE_ELEM);
+ assertEquals("TestMessageOverride", r.getMessage());
+ }
+
private static final String REF_OVERRIDE_ORIGINAL_NAME =
"" + PMD.EOL +
"" + PMD.EOL +
" testdesc" + PMD.EOL +
" " + PMD.EOL +
+ " ref=\"rulesets/unusedcode.xml/UnusedLocalVariable\" message=\"TestMessageOverride\"> " + PMD.EOL +
" " + PMD.EOL +
"";
+ private static final String REF_OVERRIDE_ORIGINAL_NAME_ONE_ELEM =
+ "" + PMD.EOL +
+ "" + PMD.EOL +
+ " testdesc" + PMD.EOL +
+ " " + PMD.EOL +
+ "";
+
private static final String REF_OVERRIDE =
"" + PMD.EOL +
"" + PMD.EOL +
diff --git a/pmd/src/net/sourceforge/pmd/RuleSetFactory.java b/pmd/src/net/sourceforge/pmd/RuleSetFactory.java
index 2ce9664535..812e6b045a 100644
--- a/pmd/src/net/sourceforge/pmd/RuleSetFactory.java
+++ b/pmd/src/net/sourceforge/pmd/RuleSetFactory.java
@@ -260,10 +260,8 @@ public class RuleSetFactory {
RuleSet externalRuleSet = rsf.createRuleSet(ResourceLoader.loadResourceAsStream(externalRuleID.getFilename()));
Rule externalRule = externalRuleSet.getRuleByName(externalRuleID.getRuleName());
- if (ruleNode.getFirstChild() != null) {
- OverrideParser p = new OverrideParser((Element)ruleNode);
- p.overrideAsNecessary(externalRule);
- }
+ OverrideParser p = new OverrideParser((Element)ruleNode);
+ p.overrideAsNecessary(externalRule);
ruleSet.addRule(externalRule);
}
diff --git a/pmd/xdocs/credits.xml b/pmd/xdocs/credits.xml
index 41a781c892..3f307b0127 100644
--- a/pmd/xdocs/credits.xml
+++ b/pmd/xdocs/credits.xml
@@ -43,11 +43,11 @@
+ - Wouter Zelle - Fixed a devious bug in RuleSetFactory, AvoidPrintStackTrace, initial implementation of SimplifyConditional
- Wim Deblauwe - noted problems with web site rule index, bug report for JUnitTestsShouldContainAsserts, Clover license coordination and implementation, UseCorrectExceptionLogging, coordinated and coded a much nicer asXML() implementation, suggested cleanup of UnusedFormalParameter, Javadoc patch, SystemPrintln bug report, helped get Ant task and CLI squared away with JDK 1.5 params, JDK 1.5-specific bug reports, suggested improvements for ExceptionSignatureDeclaration
- Dennis Klemann - reported fix for pmd.bat problem
- Jeff Chamblee - bug report for CompareObjectsWithEquals
- Tor Norbye - Suggested CompareObjectsWithEquals
- - Wouter Zelle - AvoidPrintStackTrace, initial implementation of SimplifyConditional
- Thomas Skariah - bug reports for MethodArgumentCouldBeFinal and AvoidReassigningParameters
- Tom Parker - bug report for MethodReturnsInternalArray, found missed case in NullAssignment, suggested addition to UnnecessaryBooleanAssertion, suggested splitting up AvoidThrowingCertainExceptionTypes, AvoidInstantiatingObjectsInLoops bug report, AtLeastOneConstructor bug report
- Bruno Juillet - bug report for missing package/class/method names, patch for Ant task's excludeMarker attribute, bug report on ruleset overrides