This was in 5.0.5 too, and is also in the 5.1.0 release. Here's how to reproduce it (change the path to the pmd-bin release)
mkdir /tmp/pmd-test
cd /tmp/pmd-test
cat >Escape.java<<EOF
public class Escape {
public static String escape(final String value)
{
StringBuilder s = new StringBuilder(value.length() + 2);
s.append('"');
for (int i = 0; i < value.length(); i++) {
s.append(value.charAt(i));
}
s.append('"');
return s.toString();
}
public static void main(final String[] args) {
System.out.println(escape(args[0]));
}
}
EOF
~/tools/pmd-bin-5.1.0/bin/run.sh pmd -R java-strings -d .
/tmp/pmd-test/Escape.java:5: StringBuffer (or StringBuilder).append is called 2 consecutive times with literal Strings. Use a single append with a single combined String.
I can't see where there are 2 literal String appends. Possibly PMD gets tripped up by the for loop in the middle? Or maybe the '"' character is causing problems.
This will be fixed with the next release.
That was quick, thanks :)