Skip to content

Commit 59dba6e

Browse files
authored
HADOOP-19134. Use StringBuilder instead of StringBuffer. (apache#6692). Contributed by PJ Fanning
1 parent b5f8899 commit 59dba6e

File tree

122 files changed

+195
-196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+195
-196
lines changed

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyShell.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ protected int init(String[] args) throws IOException {
169169

170170
@Override
171171
public String getCommandUsage() {
172-
StringBuffer sbuf = new StringBuffer(USAGE_PREFIX + COMMANDS);
172+
StringBuilder sbuf = new StringBuilder(USAGE_PREFIX + COMMANDS);
173173
String banner = StringUtils.repeat("=", 66);
174174
sbuf.append(banner + "\n");
175175
sbuf.append(CreateCommand.USAGE + ":\n\n" + CreateCommand.DESC + "\n");

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/DF.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ protected void parseExecResult(BufferedReader lines) throws IOException {
163163
@VisibleForTesting
164164
protected void parseOutput() throws IOException {
165165
if (output.size() < 2) {
166-
StringBuffer sb = new StringBuffer("Fewer lines of output than expected");
166+
StringBuilder sb = new StringBuilder("Fewer lines of output than expected");
167167
if (output.size() > 0) {
168168
sb.append(": " + output.get(0));
169169
}

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ private static void unTarUsingTar(InputStream inputStream, File untarDir,
10521052

10531053
private static void unTarUsingTar(File inFile, File untarDir,
10541054
boolean gzipped) throws IOException {
1055-
StringBuffer untarCommand = new StringBuffer();
1055+
StringBuilder untarCommand = new StringBuilder();
10561056
// not using canonical path here; this postpones relative path
10571057
// resolution until bash is executed.
10581058
final String source = "'" + FileUtil.makeSecureShellPath(inFile) + "'";

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcDeniedReply.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public RejectState getRejectState() {
5858

5959
@Override
6060
public String toString() {
61-
return new StringBuffer().append("xid:").append(xid)
61+
return new StringBuilder().append("xid:").append(xid)
6262
.append(",messageType:").append(messageType).append("verifier_flavor:")
6363
.append(verifier.getFlavor()).append("rejectState:")
6464
.append(rejectState).toString();

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ProviderUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public static Configuration excludeIncompatibleCredentialProviders(
148148
if (providerPath == null) {
149149
return config;
150150
}
151-
StringBuffer newProviderPath = new StringBuffer();
151+
StringBuilder newProviderPath = new StringBuilder();
152152
String[] providers = providerPath.split(",");
153153
Path path = null;
154154
for (String provider: providers) {

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/alias/CredentialShell.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ protected int init(String[] args) throws IOException {
127127

128128
@Override
129129
public String getCommandUsage() {
130-
StringBuffer sbuf = new StringBuffer(USAGE_PREFIX + COMMANDS);
130+
StringBuilder sbuf = new StringBuilder(USAGE_PREFIX + COMMANDS);
131131
String banner = StringUtils.repeat("=", 66);
132132
sbuf.append(banner + "\n")
133133
.append(CreateCommand.USAGE + ":\n\n" + CreateCommand.DESC + "\n")

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLHostnameVerifier.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ public void check(final String[] hosts, final String[] cns,
370370
strictWithSubDomains);
371371
}
372372
// Build up lists of allowed hosts For logging/debugging purposes.
373-
StringBuffer buf = new StringBuffer(32);
373+
StringBuilder buf = new StringBuilder(32);
374374
buf.append('<');
375375
for (int i = 0; i < hosts.length; i++) {
376376
String h = hosts[i];
@@ -408,15 +408,15 @@ public void check(final String[] hosts, final String[] cns,
408408
throw new SSLException(msg);
409409
}
410410

411-
// StringBuffer for building the error message.
412-
buf = new StringBuffer();
411+
// StringBuilder for building the error message.
412+
buf = new StringBuilder();
413413

414414
boolean match = false;
415415
out:
416416
for (Iterator<String> it = names.iterator(); it.hasNext();) {
417417
// Don't trim the CN, though!
418418
final String cn = StringUtils.toLowerCase(it.next());
419-
// Store CN in StringBuffer in case we need to report an error.
419+
// Store CN in StringBuilder in case we need to report an error.
420420
buf.append(" <")
421421
.append(cn)
422422
.append('>');

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ private void runCommand() throws IOException {
10141014
BufferedReader inReader =
10151015
new BufferedReader(new InputStreamReader(process.getInputStream(),
10161016
StandardCharsets.UTF_8));
1017-
final StringBuffer errMsg = new StringBuffer();
1017+
final StringBuilder errMsg = new StringBuilder();
10181018

10191019
// read error and input streams as this would free up the buffers
10201020
// free the error stream buffer
@@ -1208,7 +1208,7 @@ public static class ShellCommandExecutor extends Shell
12081208
implements CommandExecutor {
12091209

12101210
private String[] command;
1211-
private StringBuffer output;
1211+
private StringBuilder output;
12121212

12131213

12141214
public ShellCommandExecutor(String[] execString) {
@@ -1289,7 +1289,7 @@ public String[] getExecString() {
12891289

12901290
@Override
12911291
protected void parseExecResult(BufferedReader lines) throws IOException {
1292-
output = new StringBuffer();
1292+
output = new StringBuilder();
12931293
char[] buf = new char[512];
12941294
int nRead;
12951295
while ( (nRead = lines.read(buf, 0, buf.length)) > 0 ) {

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/StringUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ public static String wrap(String str, int wrapLength, String newLineStr,
13341334

13351335
int inputLineLength = str.length();
13361336
int offset = 0;
1337-
StringBuffer wrappedLine = new StringBuffer(inputLineLength + 32);
1337+
StringBuilder wrappedLine = new StringBuilder(inputLineLength + 32);
13381338

13391339
while(inputLineLength - offset > wrapLength) {
13401340
if(str.charAt(offset) == 32) {

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestCount.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ public MockQuotaUsage() {
580580
public String toString(boolean hOption,
581581
boolean tOption, List<StorageType> types) {
582582
if (tOption) {
583-
StringBuffer result = new StringBuffer();
583+
StringBuilder result = new StringBuilder();
584584
result.append(hOption ? HUMAN : BYTES);
585585

586586
for (StorageType type : types) {

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/alias/TestCredentialProviderFactory.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public void testUriErrors() throws Exception {
114114
}
115115

116116
private static char[] generatePassword(int length) {
117-
StringBuffer sb = new StringBuffer();
117+
StringBuilder sb = new StringBuilder();
118118
Random r = new Random();
119119
for (int i = 0; i < length; i++) {
120120
sb.append(chars[r.nextInt(chars.length)]);

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestShell.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ public void testBashQuote() {
480480
@Test(timeout=120000)
481481
public void testDestroyAllShellProcesses() throws Throwable {
482482
Assume.assumeFalse(WINDOWS);
483-
StringBuffer sleepCommand = new StringBuffer();
483+
StringBuilder sleepCommand = new StringBuilder();
484484
sleepCommand.append("sleep 200");
485485
String[] shellCmd = {"bash", "-c", sleepCommand.toString()};
486486
final ShellCommandExecutor shexc1 = new ShellCommandExecutor(shellCmd);

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/functional/TestRemoteIterators.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void log(Object o) {
8686
*/
8787
@Test
8888
public void testSingleton() throws Throwable {
89-
StringBuffer result = new StringBuffer();
89+
StringBuilder result = new StringBuilder();
9090
String name = "singleton";
9191
RemoteIterator<String> it = remoteIteratorFromSingleton(name);
9292
assertStringValueContains(it, "SingletonIterator");

hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/TestKMS.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ protected String generateLoadBalancingKeyProviderUriString() {
167167
if (kmsUrl == null || kmsUrl.size() == 0) {
168168
return null;
169169
}
170-
StringBuffer sb = new StringBuffer();
170+
StringBuilder sb = new StringBuilder();
171171

172172
for (int i = 0; i < kmsUrl.size(); i++) {
173173
sb.append(KMSClientProvider.SCHEME_NAME + "://" +

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSck.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ private Integer listCorruptFileBlocks(String dir, String baseUrl)
195195
final String cookiePrefix = "Cookie:";
196196
boolean allDone = false;
197197
while (!allDone) {
198-
final StringBuffer url = new StringBuffer(baseUrl);
198+
final StringBuilder url = new StringBuilder(baseUrl);
199199
if (cookie > 0) {
200200
url.append("&startblockafter=").append(String.valueOf(cookie));
201201
}

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineEditsViewer/OfflineEditsXmlLoader.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp;
3333
import org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes;
3434
import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.OpInstanceCache;
35-
import org.apache.hadoop.hdfs.tools.offlineEditsViewer.OfflineEditsViewer;
3635
import org.apache.hadoop.hdfs.util.XMLUtils.Stanza;
3736
import org.xml.sax.Attributes;
3837
import org.xml.sax.InputSource;
@@ -57,7 +56,7 @@ class OfflineEditsXmlLoader
5756
private Stanza stanza;
5857
private Stack<Stanza> stanzaStack;
5958
private FSEditLogOpCodes opCode;
60-
private StringBuffer cbuf;
59+
private StringBuilder cbuf;
6160
private long nextTxId;
6261
private final OpInstanceCache opCache = new OpInstanceCache();
6362

@@ -119,7 +118,7 @@ public void startDocument() {
119118
stanza = null;
120119
stanzaStack = new Stack<Stanza>();
121120
opCode = null;
122-
cbuf = new StringBuffer();
121+
cbuf = new StringBuilder();
123122
nextTxId = -1;
124123
}
125124

@@ -182,7 +181,7 @@ public void startElement (String uri, String name,
182181
@Override
183182
public void endElement (String uri, String name, String qName) {
184183
String str = XMLUtils.unmangleXmlString(cbuf.toString(), false).trim();
185-
cbuf = new StringBuffer();
184+
cbuf = new StringBuilder();
186185
switch (state) {
187186
case EXPECT_EDITS_TAG:
188187
throw new InvalidXmlException("expected <EDITS/>");

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageCorruption.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ long getId() {
8585
}
8686

8787
String getType() {
88-
StringBuffer s = new StringBuffer();
88+
StringBuilder s = new StringBuilder();
8989
if (type.contains(PBImageCorruptionType.CORRUPT_NODE)) {
9090
s.append(PBImageCorruptionType.CORRUPT_NODE);
9191
}

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ private class MyFile {
340340
for (int idx = 0; idx < nLevels; idx++) {
341341
levels[idx] = gen.nextInt(10);
342342
}
343-
StringBuffer sb = new StringBuffer();
343+
StringBuilder sb = new StringBuilder();
344344
for (int idx = 0; idx < nLevels; idx++) {
345345
sb.append(dirNames[levels[idx]]);
346346
sb.append("/");

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHDFSTrash.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ private Trash getPerUserTrash(UserGroupInformation ugi,
180180
FileSystem fileSystem, Configuration config) throws IOException {
181181
// generate an unique path per instance
182182
UUID trashId = UUID.randomUUID();
183-
StringBuffer sb = new StringBuffer()
183+
StringBuilder sb = new StringBuilder()
184184
.append(ugi.getUserName())
185185
.append("-")
186186
.append(trashId.toString());

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1833,7 +1833,7 @@ public void testMetaSavePostponedMisreplicatedBlocks() throws IOException {
18331833
DataInputStream in = new DataInputStream(fstream);
18341834

18351835
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
1836-
StringBuffer buffer = new StringBuffer();
1836+
StringBuilder buffer = new StringBuilder();
18371837
String line;
18381838
try {
18391839
while ((line = reader.readLine()) != null) {
@@ -1861,7 +1861,7 @@ public void testMetaSaveMissingReplicas() throws Exception {
18611861
FileInputStream fstream = new FileInputStream(file);
18621862
DataInputStream in = new DataInputStream(fstream);
18631863
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
1864-
StringBuffer buffer = new StringBuffer();
1864+
StringBuilder buffer = new StringBuilder();
18651865
String line;
18661866
try {
18671867
while ((line = reader.readLine()) != null) {
@@ -1933,7 +1933,7 @@ public void testMetaSaveInMaintenanceReplicas() throws Exception {
19331933
FileInputStream fstream = new FileInputStream(file);
19341934
DataInputStream in = new DataInputStream(fstream);
19351935
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
1936-
StringBuffer buffer = new StringBuffer();
1936+
StringBuilder buffer = new StringBuilder();
19371937
String line;
19381938
try {
19391939
while ((line = reader.readLine()) != null) {
@@ -1989,7 +1989,7 @@ public void testMetaSaveDecommissioningReplicas() throws Exception {
19891989
FileInputStream fstream = new FileInputStream(file);
19901990
DataInputStream in = new DataInputStream(fstream);
19911991
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
1992-
StringBuffer buffer = new StringBuffer();
1992+
StringBuilder buffer = new StringBuilder();
19931993
String line;
19941994
try {
19951995
while ((line = reader.readLine()) != null) {

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/web/resources/TestWebHdfsDataLocality.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public void testExcludeDataNodes() throws Exception {
196196
//For GETFILECHECKSUM, OPEN and APPEND,
197197
//the chosen datanode must be different with exclude nodes.
198198

199-
StringBuffer sb = new StringBuffer();
199+
StringBuilder sb = new StringBuilder();
200200
for (int i = 0; i < 2; i++) {
201201
sb.append(locations[i].getXferAddr());
202202
{ // test GETFILECHECKSUM

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/ConfBlock.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public class ConfBlock extends HtmlBlock {
8383
__().
8484
tbody();
8585
for (ConfEntryInfo entry : info.getProperties()) {
86-
StringBuffer buffer = new StringBuffer();
86+
StringBuilder buffer = new StringBuilder();
8787
String[] sources = entry.getSource();
8888
//Skip the last entry, because it is always the same HDFS file, and
8989
// output them in reverse order so most recent is output first

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestRecovery.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2080,7 +2080,7 @@ private void writeOutput(TaskAttempt attempt, Configuration conf)
20802080

20812081
private void validateOutput() throws IOException {
20822082
File expectedFile = new File(new Path(outputDir, partFile).toString());
2083-
StringBuffer expectedOutput = new StringBuffer();
2083+
StringBuilder expectedOutput = new StringBuilder();
20842084
expectedOutput.append(key1).append('\t').append(val1).append("\n");
20852085
expectedOutput.append(val1).append("\n");
20862086
expectedOutput.append(val2).append("\n");

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/webapp/TestAMWebServicesAttempts.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ public void verifyTaskAttemptGeneric(TaskAttempt ta, TaskType ttype,
516516
String expectDiag = "";
517517
List<String> diagnosticsList = ta.getDiagnostics();
518518
if (diagnosticsList != null && !diagnostics.isEmpty()) {
519-
StringBuffer b = new StringBuffer();
519+
StringBuilder b = new StringBuilder();
520520
for (String diag : diagnosticsList) {
521521
b.append(diag);
522522
}

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/webapp/TestAMWebServicesJobs.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ public void verifyAMJobGenericSecure(Job job, int mapsPending,
600600
String diagString = "";
601601
List<String> diagList = job.getDiagnostics();
602602
if (diagList != null && !diagList.isEmpty()) {
603-
StringBuffer b = new StringBuffer();
603+
StringBuilder b = new StringBuilder();
604604
for (String diag : diagList) {
605605
b.append(diag);
606606
}

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapred/LocalJobRunner.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1027,8 +1027,8 @@ static void setupChildMapredLocalDirs(Task t, JobConf conf) {
10271027
String taskId = t.getTaskID().toString();
10281028
boolean isCleanup = t.isTaskCleanupTask();
10291029
String user = t.getUser();
1030-
StringBuffer childMapredLocalDir =
1031-
new StringBuffer(localDirs[0] + Path.SEPARATOR
1030+
StringBuilder childMapredLocalDir =
1031+
new StringBuilder(localDirs[0] + Path.SEPARATOR
10321032
+ getLocalTaskDir(user, jobId, taskId, isCleanup));
10331033
for (int i = 1; i < localDirs.length; i++) {
10341034
childMapredLocalDir.append("," + localDirs[i] + Path.SEPARATOR

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRWebAppUtil.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public static String getApplicationWebURLOnJHSWithoutScheme(Configuration conf,
145145
InetSocketAddress address = NetUtils.createSocketAddr(
146146
hsAddress, getDefaultJHSWebappPort(),
147147
getDefaultJHSWebappURLWithoutScheme());
148-
StringBuffer sb = new StringBuffer();
148+
StringBuilder sb = new StringBuilder();
149149
if (address.getAddress() != null &&
150150
(address.getAddress().isAnyLocalAddress() ||
151151
address.getAddress().isLoopbackAddress())) {

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/test/java/org/apache/hadoop/mapred/TestLocalModeWithNewApis.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public void testNewApis() throws Exception {
102102
static String readOutput(Path outDir, Configuration conf)
103103
throws IOException {
104104
FileSystem fs = outDir.getFileSystem(conf);
105-
StringBuffer result = new StringBuffer();
105+
StringBuilder result = new StringBuilder();
106106

107107
Path[] fileList = FileUtil.stat2Paths(fs.listStatus(outDir,
108108
new Utils.OutputFileUtils.OutputFilesFilter()));

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/FileInputFormat.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ public static void addInputPaths(JobConf conf, String commaSeparatedPaths) {
470470
*/
471471
public static void setInputPaths(JobConf conf, Path... inputPaths) {
472472
Path path = new Path(conf.getWorkingDirectory(), inputPaths[0]);
473-
StringBuffer str = new StringBuffer(StringUtils.escapeString(path.toString()));
473+
StringBuilder str = new StringBuilder(StringUtils.escapeString(path.toString()));
474474
for(int i = 1; i < inputPaths.length;i++) {
475475
str.append(StringUtils.COMMA_STR);
476476
path = new Path(conf.getWorkingDirectory(), inputPaths[i]);

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/InvalidInputException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public List<IOException> getProblems() {
6161
* @return the concatenated messages from all of the problems.
6262
*/
6363
public String getMessage() {
64-
StringBuffer result = new StringBuffer();
64+
StringBuilder result = new StringBuilder();
6565
Iterator<IOException> itr = problems.iterator();
6666
while(itr.hasNext()) {
6767
result.append(itr.next().getMessage());

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/MultiFileSplit.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private void addToSet(Set<String> set, String[] array) {
7070

7171
@Override
7272
public String toString() {
73-
StringBuffer sb = new StringBuffer();
73+
StringBuilder sb = new StringBuilder();
7474
for(int i=0; i < getPaths().length; i++) {
7575
sb.append(getPath(i).toUri().getPath() + ":0+" + getLength(i));
7676
if (i < getPaths().length -1) {

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/SortedRanges.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public synchronized void write(DataOutput out) throws IOException {
207207
}
208208

209209
public String toString() {
210-
StringBuffer sb = new StringBuffer();
210+
StringBuilder sb = new StringBuilder();
211211
Iterator<Range> it = ranges.iterator();
212212
while(it.hasNext()) {
213213
Range range = it.next();

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLog.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,8 @@ static String buildCommandLine(List<String> setup, List<String> cmd,
518518
throws IOException {
519519

520520
String stdout = FileUtil.makeShellPath(stdoutFilename);
521-
String stderr = FileUtil.makeShellPath(stderrFilename);
522-
StringBuffer mergedCmd = new StringBuffer();
521+
String stderr = FileUtil.makeShellPath(stderrFilename);
522+
StringBuilder mergedCmd = new StringBuilder();
523523

524524
// Export the pid of taskJvm to env variable JVM_PID.
525525
// Currently pid is not used on Windows
@@ -606,7 +606,7 @@ static String buildDebugScriptCommandLine(List<String> cmd, String debugout)
606606
*/
607607
public static String addCommand(List<String> cmd, boolean isExecutable)
608608
throws IOException {
609-
StringBuffer command = new StringBuffer();
609+
StringBuilder command = new StringBuilder();
610610
for(String s: cmd) {
611611
command.append('\'');
612612
if (isExecutable) {

0 commit comments

Comments
 (0)