aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2024-10-15 12:58:33 +0000
committerPJ Fanning <fanningpj@apache.org>2024-10-15 12:58:33 +0000
commitab68210d2ace09d73a9468d908e61ab56750bb31 (patch)
treebac858522650bcb0323cac9d9ff8259c544ed3e9
parentf8bbec3104cbffb52bb1c9784a5747a1f339d0f9 (diff)
downloadpoi-ab68210d2ace09d73a9468d908e61ab56750bb31.tar.gz
poi-ab68210d2ace09d73a9468d908e61ab56750bb31.zip
[github-709] Make BitFieldFactory threadsafe. Thanks to ZhangChen. This closes #709
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1921332 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--poi/src/main/java/org/apache/poi/util/BitFieldFactory.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/poi/src/main/java/org/apache/poi/util/BitFieldFactory.java b/poi/src/main/java/org/apache/poi/util/BitFieldFactory.java
index 4893d5e61b..40e69cb0bd 100644
--- a/poi/src/main/java/org/apache/poi/util/BitFieldFactory.java
+++ b/poi/src/main/java/org/apache/poi/util/BitFieldFactory.java
@@ -18,13 +18,13 @@
package org.apache.poi.util;
-import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
/**
* Returns immutable Bitfield instances.
*/
public class BitFieldFactory {
- private static Map<Integer, BitField> instances = new HashMap<>();
+ private static final ConcurrentHashMap<Integer, BitField> instances = new ConcurrentHashMap<>();
public static BitField getInstance(int mask) {
return instances.computeIfAbsent(mask, k -> new BitField(mask));