From ab68210d2ace09d73a9468d908e61ab56750bb31 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Tue, 15 Oct 2024 12:58:33 +0000 Subject: [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 --- poi/src/main/java/org/apache/poi/util/BitFieldFactory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'poi') 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 instances = new HashMap<>(); + private static final ConcurrentHashMap instances = new ConcurrentHashMap<>(); public static BitField getInstance(int mask) { return instances.computeIfAbsent(mask, k -> new BitField(mask)); -- cgit v1.2.3