Browse Source

CaseInsensitiveMap is not thread-safe

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894738 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_5_2_0
PJ Fanning 2 years ago
parent
commit
e40b4e1ec9

+ 2
- 2
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java View File

@@ -19,8 +19,8 @@ package org.apache.poi.xssf.usermodel;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentSkipListMap;

import org.apache.commons.collections4.map.CaseInsensitiveMap;
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.formula.EvaluationName;
import org.apache.poi.ss.formula.EvaluationWorkbook;
@@ -364,7 +364,7 @@ public abstract class BaseXSSFEvaluationWorkbook implements FormulaRenderingWork
if ( _tableCache != null ) {
return _tableCache;
}
_tableCache = new CaseInsensitiveMap<>();
_tableCache = new ConcurrentSkipListMap<>(String.CASE_INSENSITIVE_ORDER);

for (Sheet sheet : _uBook) {
for (XSSFTable tbl : ((XSSFSheet)sheet).getTables()) {

+ 3
- 4
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java View File

@@ -26,8 +26,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ConcurrentSkipListMap;

import org.apache.commons.collections4.map.CaseInsensitiveMap;
import org.apache.poi.ooxml.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.ss.SpreadsheetVersion;
@@ -59,7 +59,7 @@ public class XSSFTable extends POIXMLDocumentPart implements Table {
private CTTable ctTable;
private transient List<XSSFXmlColumnPr> xmlColumnPrs;
private transient List<XSSFTableColumn> tableColumns;
private transient CaseInsensitiveMap<String, Integer> columnMap;
private transient ConcurrentSkipListMap<String, Integer> columnMap;
private transient CellReference startCellReference;
private transient CellReference endCellReference;
private transient String commonXPath;
@@ -831,8 +831,7 @@ public class XSSFTable extends POIXMLDocumentPart implements Table {
public int findColumnIndex(String columnHeader) {
if (columnHeader == null) return -1;
if (columnMap == null) {
final int count = getColumnCount();
columnMap = new CaseInsensitiveMap<>(count * 3 / 2);
columnMap = new ConcurrentSkipListMap<>(String.CASE_INSENSITIVE_ORDER);

int i = 0;
for (XSSFTableColumn column : getColumns()) {

Loading…
Cancel
Save