aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml/src
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2024-10-15 16:16:51 +0000
committerPJ Fanning <fanningpj@apache.org>2024-10-15 16:16:51 +0000
commitc5986447d18d6bb3a06f5a31888a244355c963ac (patch)
treee6108746926fa5d81dc2155d4ff32ec46b81dade /poi-ooxml/src
parentfad6cae019d3dbca9c143855d77f4d2b11c6df3b (diff)
downloadpoi-c5986447d18d6bb3a06f5a31888a244355c963ac.tar.gz
poi-c5986447d18d6bb3a06f5a31888a244355c963ac.zip
thread safety
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1921339 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml/src')
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/Borders.java7
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/UnderlinePatterns.java7
2 files changed, 10 insertions, 4 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/Borders.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/Borders.java
index f2763f4fab..2ab27d37da 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/Borders.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/Borders.java
@@ -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;
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/UnderlinePatterns.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/UnderlinePatterns.java
index 0e27f429f3..05eb5d422f 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/UnderlinePatterns.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/UnderlinePatterns.java
@@ -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;