NullPointerException in ConsecutiveLiteralAppendsRule
A source code analyzer
Brought to you by:
adangel,
juansotuyo
I updated from 5.3.2 to 5.3.3 and now I get this NullPointerException.
Exception applying rule ConsecutiveLiteralAppends on file <snip path="">\CatalogHandler.java, continuing with next rule
java.lang.NullPointerException
at net.sourceforge.pmd.lang.java.rule.strings.ConsecutiveLiteralAppendsRule.checkInitializerExpressions(Consecut
iveLiteralAppendsRule.java:195)
at net.sourceforge.pmd.lang.java.rule.strings.ConsecutiveLiteralAppendsRule.visit(ConsecutiveLiteralAppendsRule.
java:93)
It happens when the StringBuilder is declared as a member variable but not instantiated until the constructor.
Example to reproduce the problem.
public class ConsecutiveLiteralAppendsRuleTest {
private StringBuilder cdata;
}
The following produces the same NullPointerException in 5.3.3 too:
Last edit: Toby Willcock 2015-07-27
Thanks!
This will be fixed with PMD 5.3.4.
Commit: https://github.com/pmd/pmd/commit/89a3d5dd1e58355b0f96360ebba80882634c680e
Awesome! Any schedule for 5.3.4 / 5.4.0?
I release 5.3.4 this weekend and plan to release 5.4.0 in two weeks or so...