From 30c85ad05363767deeefee577063c2c432b971d4 Mon Sep 17 00:00:00 2001 From: Sebb Date: Thu, 16 Feb 2017 18:59:01 +0000 Subject: [PATCH] Use StringBuilders instead of StringBuffers (A couple of instances were overlooked) This fixes #236 --- .../java/org/apache/commons/lang3/RandomStringUtils.java | 6 +++--- src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/RandomStringUtils.java b/src/main/java/org/apache/commons/lang3/RandomStringUtils.java index 549bea2ca..ec62d509c 100644 --- a/src/main/java/org/apache/commons/lang3/RandomStringUtils.java +++ b/src/main/java/org/apache/commons/lang3/RandomStringUtils.java @@ -380,7 +380,7 @@ public class RandomStringUtils { } } - StringBuffer buffer = new StringBuffer(count); + StringBuilder builder = new StringBuilder(count); final int gap = end - start; while (count-- != 0) { @@ -409,7 +409,7 @@ public class RandomStringUtils { if (letters && Character.isLetter(codePoint) || numbers && Character.isDigit(codePoint) || !letters && !numbers) { - buffer.appendCodePoint(codePoint); + builder.appendCodePoint(codePoint); if (numberOfChars == 2) { count--; @@ -419,7 +419,7 @@ public class RandomStringUtils { count++; } } - return buffer.toString(); + return builder.toString(); } diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java index 657a85ec7..63da4e457 100644 --- a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java @@ -280,8 +280,8 @@ public class ArrayUtilsTest { assertTrue(Arrays.equals(original1, cloned1)); assertTrue(original1 != cloned1); - final StringBuffer buf = new StringBuffer("pick"); - original1 = new Object[] {buf, "a", new String[] {"stick"}}; + final StringBuilder builder = new StringBuilder("pick"); + original1 = new Object[] {builder, "a", new String[] {"stick"}}; cloned1 = ArrayUtils.clone(original1); assertTrue(Arrays.equals(original1, cloned1)); assertTrue(original1 != cloned1);