Skip to content

Commit e1852e7

Browse files
authored
Non-final Static Singleton Variables Break Thread Safety and Singleton Design in RandomStringUtils (#1513)
1 parent 966c1dc commit e1852e7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/org/apache/commons/lang3/RandomStringUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ public class RandomStringUtils {
8282

8383
private static final Supplier<RandomUtils> SECURE_SUPPLIER = RandomUtils::secure;
8484

85-
private static RandomStringUtils INSECURE = new RandomStringUtils(RandomUtils::insecure);
85+
private static final RandomStringUtils INSECURE = new RandomStringUtils(RandomUtils::insecure);
8686

87-
private static RandomStringUtils SECURE = new RandomStringUtils(SECURE_SUPPLIER);
87+
private static final RandomStringUtils SECURE = new RandomStringUtils(SECURE_SUPPLIER);
8888

89-
private static RandomStringUtils SECURE_STRONG = new RandomStringUtils(RandomUtils::secureStrong);
89+
private static final RandomStringUtils SECURE_STRONG = new RandomStringUtils(RandomUtils::secureStrong);
9090

9191
private static final char[] ALPHANUMERICAL_CHARS = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
9292
'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G',

0 commit comments

Comments
 (0)