View by Classes

Findings - Overview

info InsufficientStringBufferDeclaration (PMD)

Further info on the wiki.
Failing to pre-size a StringBuffer properly could cause it to re-size many times during runtime. This rule checks the characters that are actually passed into StringBuffer.append(), but represents a best guess "worst case" scenario. An empty StringBuffer constructor initializes the object to 16 characters. This default is assumed if the length of the constructor can not be determined.

public class Foo {
    void bar() {
        StringBuffer bad = new StringBuffer();
        bad.append("This is a long string, will exceed the default 16 characters");//bad
        StringBuffer good = new StringBuffer(41);
        good.append("This is a long string, which is pre-sized");//good
    }
}

    

Additional info can be found at this http://pmd.sourceforge.net/rules/strings.html#InsufficientStringBufferDeclaration site.

3org.jcoderz.commons.connector.http.transport.ClientHandler
StringBuffer constructor is initialized with size 16, but has at least 113 characters appended. (test code) [237:26],
StringBuffer constructor is initialized with size 16, but has at least 18 characters appended. (test code) [600:35],
StringBuffer constructor is initialized with size 16, but has at least 36 characters appended. (test code) [744:26]
2org.jcoderz.commons.connector.http.transport.HttpClientConnectionImpl
StringBuffer constructor is initialized with size 16, but has at least 119 characters appended. [656:26],
StringBuffer constructor is initialized with size 16, but has at least 141 characters appended. [685:26]
1org.jcoderz.commons.tracing.AsmUtil
StringBuffer constructor is initialized with size 16, but has at least 86 characters appended. [199:13]
1org.jcoderz.phoenix.sqlparser.CreateSequenceStatement
StringBuffer constructor is initialized with size 16, but has at least 115 characters appended. [66:26]
1org.jcoderz.commons.taskdefs.ApiDocTask
StringBuffer constructor is initialized with size 16, but has at least 28 characters appended. [421:32]
1org.jcoderz.phoenix.sqlparser.ColumnSpec
StringBuffer constructor is initialized with size 16, but has at least 153 characters appended. [249:26]
1org.jcoderz.commons.taskdefs.DiagramTask
StringBuffer constructor is initialized with size 16, but has at least 31 characters appended. [565:29]
1org.jcoderz.phoenix.servlet.PingServlet
StringBuffer constructor is initialized with size 16, but has at least 59 characters appended. [461:29]
1org.jcoderz.commons.statistics.Average
StringBuffer constructor is initialized with size 16, but has at least 35 characters appended. [160:26]
1org.jcoderz.commons.statistics.TimedCounter
StringBuffer constructor is initialized with size 16, but has at least 46 characters appended. [127:26]
1org.jcoderz.commons.connector.http.ConnectorResponse
StringBuffer constructor is initialized with size 16, but has at least 111 characters appended. (test code) [104:26]
1org.jcoderz.commons.connector.http.transport.HttpRequestResponseHeader
StringBuffer constructor is initialized with size 16, but has at least 35 characters appended. [101:26]
1org.jcoderz.phoenix.sqlparser.CreateIndexStatement
StringBuffer constructor is initialized with size 16, but has at least 60 characters appended. [95:26]
1org.jcoderz.commons.statistics.TimedAverage
StringBuffer constructor is initialized with size 16, but has at least 64 characters appended. [126:26]
1org.jcoderz.phoenix.templategen.TemplateDescr
StringBuffer constructor is initialized with size 16, but has at least 66 characters appended. [217:26]
1org.jcoderz.commons.taskdefs.XsltBasedTask
StringBuffer constructor is initialized with size 16, but has at least 18 characters appended. [235:28]
1org.jcoderz.phoenix.sqlparser.CreateTableStatement
StringBuffer constructor is initialized with size 16, but has at least 66 characters appended. [115:26]