From 72e4ab4b004482fa709de9c4c951ae9485ff1ea3 Mon Sep 17 00:00:00 2001 From: Henri Yandell Date: Sat, 9 Jan 2010 10:06:42 +0000 Subject: [PATCH] Synchronizing the COMMON Map so that getInstance doesn't miss a put from a subclass in another thread. LANG-494 git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@897408 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/java/org/apache/commons/lang3/CharSet.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/CharSet.java b/src/main/java/org/apache/commons/lang3/CharSet.java index 2dde55a9c..d1808bd95 100644 --- a/src/main/java/org/apache/commons/lang3/CharSet.java +++ b/src/main/java/org/apache/commons/lang3/CharSet.java @@ -17,6 +17,7 @@ package org.apache.commons.lang3; import java.io.Serializable; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -75,10 +76,10 @@ public class CharSet implements Serializable { /** * A Map of the common cases used in the factory. - * Subclasses can add more common patterns if desired. + * Subclasses can add more common patterns if desired * @since 2.0 */ - protected static final Map COMMON = new HashMap(); + protected static final Map COMMON = Collections.synchronizedMap(new HashMap()); static { COMMON.put(null, EMPTY);