Browse Source

Merge pull request #11990 in CORE/base-third from bugfix/11.0 to release/11.0

* commit '361b97fae9ee8fd175d44033ea297a3939e0ef92':
  REPORT-137276 fix: 并发导出下的hashmap死循环问题
release/11.0
superman 2 weeks ago
parent
commit
2c576f7ca4
  1. 26
      fine-poi-old/src/main/java/com/fr/third/org/apache/poi/hssf/record/WindowTwoRecord.java
  2. 17
      fine-poi-old/src/main/java/com/fr/third/org/apache/poi/util/BitFieldFactory.java

26
fine-poi-old/src/main/java/com/fr/third/org/apache/poi/hssf/record/WindowTwoRecord.java

@ -39,23 +39,21 @@ public class WindowTwoRecord
private short field_1_options; private short field_1_options;
// bitfields // bitfields
private BitField displayFormulas = BitFieldFactory.getInstance(0x01); private static final BitField displayFormulas = BitFieldFactory.getInstance(0x01);
private BitField displayGridlines = BitFieldFactory.getInstance(0x02); private static final BitField displayGridlines = BitFieldFactory.getInstance(0x02);
private BitField displayRowColHeadings = BitFieldFactory.getInstance(0x04); private static final BitField displayRowColHeadings = BitFieldFactory.getInstance(0x04);
private BitField freezePanes = BitFieldFactory.getInstance(0x08); private static final BitField freezePanes = BitFieldFactory.getInstance(0x08);
private BitField displayZeros = BitFieldFactory.getInstance(0x10); private static final BitField displayZeros = BitFieldFactory.getInstance(0x10);
private BitField defaultHeader = private static final BitField defaultHeader = BitFieldFactory.getInstance(0x20); // if false use color in field 4
BitFieldFactory.getInstance(0x20); // if false use color in field 4
// if true use default foreground // if true use default foreground
// for headers // for headers
private BitField arabic = private static final BitField arabic = BitFieldFactory.getInstance(0x40); // for our desert dwelling friends
BitFieldFactory.getInstance(0x40); // for our desert dwelling friends private static final BitField displayGuts = BitFieldFactory.getInstance(0x80);
private BitField displayGuts = BitFieldFactory.getInstance(0x80); private static final BitField freezePanesNoSplit = BitFieldFactory.getInstance(0x100);
private BitField freezePanesNoSplit = BitFieldFactory.getInstance(0x100); private static final BitField selected = BitFieldFactory.getInstance(0x200);
private BitField selected = BitFieldFactory.getInstance(0x200); private static final BitField active = BitFieldFactory.getInstance(0x400);
private BitField active = BitFieldFactory.getInstance(0x400); private static final BitField savedInPageBreakPreview = BitFieldFactory.getInstance(0x800);
private BitField savedInPageBreakPreview = BitFieldFactory.getInstance(0x800);
// 4-7 reserved // 4-7 reserved
// end bitfields // end bitfields

17
fine-poi-old/src/main/java/com/fr/third/org/apache/poi/util/BitFieldFactory.java

@ -19,7 +19,7 @@
package com.fr.third.org.apache.poi.util; package com.fr.third.org.apache.poi.util;
import java.util.*; import java.util.concurrent.ConcurrentHashMap;
/** /**
* Returns immutable Btfield instances. * Returns immutable Btfield instances.
@ -27,18 +27,11 @@ import java.util.*;
* @author Jason Height (jheight at apache dot org) * @author Jason Height (jheight at apache dot org)
*/ */
public class BitFieldFactory public class BitFieldFactory {
{ private static final ConcurrentHashMap<Integer, BitField> instances = new ConcurrentHashMap<>();
private static Map instances = new HashMap();
public static BitField getInstance(final int mask) { public static BitField getInstance(int mask) {
BitField f = (BitField)instances.get(new Integer(mask)); return instances.computeIfAbsent(mask, k -> new BitField(mask));
if (f == null) {
f = new BitField(mask);
instances.put(new Integer(mask), f);
} }
return f;
}
} // end public class BitFieldFactory } // end public class BitFieldFactory

Loading…
Cancel
Save