thread safety

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1921339 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2024-10-15 16:16:51 +00:00
parent fad6cae019
commit c5986447d1
2 changed files with 10 additions and 4 deletions

View File

@ -17,6 +17,7 @@
package org.apache.poi.xwpf.usermodel;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@ -598,12 +599,14 @@ public enum Borders {
ZIG_ZAG_STITCH(191);
private static Map<Integer, Borders> imap = new HashMap<>();
private static final Map<Integer, Borders> imap;
static {
final Map<Integer, Borders> tempMap = new HashMap<>();
for (Borders p : values()) {
imap.put(Integer.valueOf(p.getValue()), p);
tempMap.put(Integer.valueOf(p.getValue()), p);
}
imap = Collections.unmodifiableMap(tempMap);
}
private final int value;

View File

@ -16,6 +16,7 @@
==================================================================== */
package org.apache.poi.xwpf.usermodel;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@ -133,12 +134,14 @@ public enum UnderlinePatterns {
*/
NONE(18);
private static Map<Integer, UnderlinePatterns> imap = new HashMap<>();
private static final Map<Integer, UnderlinePatterns> imap;
static {
final Map<Integer, UnderlinePatterns> tempMap = new HashMap<>();
for (UnderlinePatterns p : values()) {
imap.put(p.getValue(), p);
tempMap.put(p.getValue(), p);
}
imap = Collections.unmodifiableMap(tempMap);
}
private final int value;