8287544: Replace uses of StringBuffer with StringBuilder in java.naming
Reviewed-by: rriggs, aefimov, vtewari
This commit is contained in:
parent
97bd4c255a
commit
f5bbade9e4
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -128,7 +128,7 @@ public final class LdapName implements Name {
|
|||||||
return unparsed;
|
return unparsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
for (int i = rdns.size() - 1; i >= 0; i--) {
|
for (int i = rdns.size() - 1; i >= 0; i--) {
|
||||||
if (i < rdns.size() - 1) {
|
if (i < rdns.size() - 1) {
|
||||||
buf.append(',');
|
buf.append(',');
|
||||||
@ -618,7 +618,7 @@ public final class LdapName implements Name {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
for (int i = 0; i < tvs.size(); i++) {
|
for (int i = 0; i < tvs.size(); i++) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
buf.append('+');
|
buf.append('+');
|
||||||
@ -798,7 +798,7 @@ public final class LdapName implements Name {
|
|||||||
|
|
||||||
final String escapees = ",=+<>#;\"\\";
|
final String escapees = ",=+<>#;\"\\";
|
||||||
char[] chars = val.toCharArray();
|
char[] chars = val.toCharArray();
|
||||||
StringBuffer buf = new StringBuffer(2 * val.length());
|
StringBuilder buf = new StringBuilder(2 * val.length());
|
||||||
|
|
||||||
// Find leading and trailing whitespace.
|
// Find leading and trailing whitespace.
|
||||||
int lead; // index of first char that is not leading whitespace
|
int lead; // index of first char that is not leading whitespace
|
||||||
@ -830,7 +830,7 @@ public final class LdapName implements Name {
|
|||||||
*/
|
*/
|
||||||
private static String escapeBinaryValue(byte[] val) {
|
private static String escapeBinaryValue(byte[] val) {
|
||||||
|
|
||||||
StringBuffer buf = new StringBuffer(1 + 2 * val.length);
|
StringBuilder buf = new StringBuilder(1 + 2 * val.length);
|
||||||
buf.append("#");
|
buf.append("#");
|
||||||
|
|
||||||
for (int i = 0; i < val.length; i++) {
|
for (int i = 0; i < val.length; i++) {
|
||||||
@ -887,7 +887,7 @@ public final class LdapName implements Name {
|
|||||||
--end;
|
--end;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuffer buf = new StringBuffer(end - beg);
|
StringBuilder buf = new StringBuilder(end - beg);
|
||||||
int esc = -1; // index of the last escaped character
|
int esc = -1; // index of the last escaped character
|
||||||
|
|
||||||
for (int i = beg; i < end; i++) {
|
for (int i = beg; i < end; i++) {
|
||||||
|
@ -337,11 +337,11 @@ class NameImpl {
|
|||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
private final String stringifyComp(String comp) {
|
private String stringifyComp(String comp) {
|
||||||
int len = comp.length();
|
int len = comp.length();
|
||||||
boolean escapeSeparator = false, escapeSeparator2 = false;
|
boolean escapeSeparator = false, escapeSeparator2 = false;
|
||||||
String beginQuote = null, endQuote = null;
|
String beginQuote = null, endQuote = null;
|
||||||
StringBuffer strbuf = new StringBuffer(len);
|
StringBuilder strbuf = new StringBuilder(len);
|
||||||
|
|
||||||
// determine whether there are any separators; if so escape
|
// determine whether there are any separators; if so escape
|
||||||
// or quote them
|
// or quote them
|
||||||
@ -449,7 +449,7 @@ class NameImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer answer = new StringBuffer();
|
StringBuilder answer = new StringBuilder();
|
||||||
String comp;
|
String comp;
|
||||||
boolean compsAllEmpty = true;
|
boolean compsAllEmpty = true;
|
||||||
int size = components.size();
|
int size = components.size();
|
||||||
|
Loading…
Reference in New Issue
Block a user