This rule is defined by the following Java class: net.sourceforge.pmd.rules.strings.UseStringBufferLength
Example:
public class Foo { void bar() { StringBuffer sb = new StringBuffer(); // this is bad if(sb.toString().equals("")) {} // this is good if(sb.length() == 0) {} } }