Skip to content

Commit

Permalink
8287544: Replace uses of StringBuffer with StringBuilder in java.naming
Browse files Browse the repository at this point in the history
Reviewed-by: rriggs, aefimov, vtewari
  • Loading branch information
Andrey Turbanov committed May 31, 2022
1 parent 97bd4c2 commit f5bbade
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/java.naming/share/classes/com/sun/jndi/ldap/LdapName.java
@@ -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.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -128,7 +128,7 @@ public String toString() {
return unparsed;
}

StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
for (int i = rdns.size() - 1; i >= 0; i--) {
if (i < rdns.size() - 1) {
buf.append(',');
Expand Down Expand Up @@ -618,7 +618,7 @@ void add(TypeAndValue tv) {
}

public String toString() {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
for (int i = 0; i < tvs.size(); i++) {
if (i > 0) {
buf.append('+');
Expand Down Expand Up @@ -798,7 +798,7 @@ private static String escapeStringValue(String val) {

final String escapees = ",=+<>#;\"\\";
char[] chars = val.toCharArray();
StringBuffer buf = new StringBuffer(2 * val.length());
StringBuilder buf = new StringBuilder(2 * val.length());

// Find leading and trailing whitespace.
int lead; // index of first char that is not leading whitespace
Expand Down Expand Up @@ -830,7 +830,7 @@ private static String escapeStringValue(String 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("#");

for (int i = 0; i < val.length; i++) {
Expand Down Expand Up @@ -887,7 +887,7 @@ static Object unescapeValue(String val) {
--end;
}

StringBuffer buf = new StringBuffer(end - beg);
StringBuilder buf = new StringBuilder(end - beg);
int esc = -1; // index of the last escaped character

for (int i = beg; i < end; i++) {
Expand Down
6 changes: 3 additions & 3 deletions src/java.naming/share/classes/javax/naming/NameImpl.java
Expand Up @@ -337,11 +337,11 @@ private final boolean escapingNeeded(String comp) {
return (false);
}
*/
private final String stringifyComp(String comp) {
private String stringifyComp(String comp) {
int len = comp.length();
boolean escapeSeparator = false, escapeSeparator2 = false;
String beginQuote = null, endQuote = null;
StringBuffer strbuf = new StringBuffer(len);
StringBuilder strbuf = new StringBuilder(len);

// determine whether there are any separators; if so escape
// or quote them
Expand Down Expand Up @@ -449,7 +449,7 @@ private final String stringifyComp(String comp) {
}

public String toString() {
StringBuffer answer = new StringBuffer();
StringBuilder answer = new StringBuilder();
String comp;
boolean compsAllEmpty = true;
int size = components.size();
Expand Down

0 comments on commit f5bbade

Please sign in to comment.