StringBuffer to StringBuilder

This commit is contained in:
XenoAmess
2020-08-24 16:45:11 +08:00
parent 3a7ea4b606
commit 33e4f98274
9 changed files with 9 additions and 9 deletions

View File

@ -173,7 +173,7 @@ public class HTMLRenderer extends AbstractIncrementingRenderer {
writer.write("<table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><tr>" + PMD.EOL
+ "<th>File</th><th>Problem</th></tr>" + PMD.EOL);
StringBuffer buf = new StringBuffer(500);
StringBuilder buf = new StringBuilder(500);
boolean colorize = true;
for (Report.ProcessingError pe : errors) {
buf.setLength(0);

View File

@ -50,7 +50,7 @@ public class TextPadRenderer extends AbstractIncrementingRenderer {
@Override
public void renderFileViolations(Iterator<RuleViolation> violations) throws IOException {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
while (violations.hasNext()) {
RuleViolation rv = violations.next();
buf.setLength(0);

View File

@ -66,7 +66,7 @@ public class DFAPanel extends JComponent implements ListSelectionListener {
return "";
}
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(kids.get(0).getIndex());
for (int j = 1; j < node.getChildren().size(); j++) {

View File

@ -710,7 +710,7 @@ public class Designer implements ClipboardOwner {
String text;
if (value instanceof Node) {
Node node = (Node) value;
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
String name = node.getClass().getName().substring(node.getClass().getName().lastIndexOf('.') + 1);
if (Proxy.isProxyClass(value.getClass())) {
name = value.toString();

View File

@ -38,7 +38,7 @@ public class SimpleNodeSubMenu extends JMenu {
}
private void init() {
StringBuffer buf = new StringBuffer(200);
StringBuilder buf = new StringBuilder(200);
for (Node temp = node; temp != null; temp = temp.getParent()) {
buf.insert(0, "/" + temp.toString());
}

View File

@ -57,7 +57,7 @@ public class FileReporterTest {
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(file));
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder();
String line = reader.readLine();
while (line != null) {
buffer.append(line);

View File

@ -510,7 +510,7 @@ public abstract class RuleTst {
}
private static String parseTextNode(Node exampleNode) {
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < exampleNode.getChildNodes().getLength(); i++) {
Node node = exampleNode.getChildNodes().item(i);
if (node.getNodeType() == Node.CDATA_SECTION_NODE || node.getNodeType() == Node.TEXT_NODE) {

View File

@ -162,7 +162,7 @@ public class TemplateParseException extends ParseException {
int maxSize = 0;
final StringBuffer expected = new StringBuffer();
final StringBuilder expected = new StringBuilder();
for (int i = 0; i < expectedTokenSequences.length; i++) {
if (maxSize < expectedTokenSequences[i].length) {

View File

@ -67,7 +67,7 @@ public class TokenMgrError extends RuntimeException {
* equivalents in the given string
*/
protected static final String addEscapes(final String str) {
final StringBuffer retval = new StringBuffer();
final StringBuilder retval = new StringBuilder();
char ch;
for (int i = 0; i < str.length(); i++) {
switch (str.charAt(i)) {