Skip to content

Commit

Permalink
thread safety
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1921339 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
pjfanning committed Oct 15, 2024
1 parent fad6cae commit c598644
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more

package org.apache.poi.xwpf.usermodel;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
==================================================================== */
package org.apache.poi.xwpf.usermodel;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c598644

Please sign in to comment.