aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml/src/main/java
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-11-03 15:20:32 +0000
committerPJ Fanning <fanningpj@apache.org>2021-11-03 15:20:32 +0000
commit584c8c059b6b317178df635b37244c6e393d6c96 (patch)
treeec47cfebcac679d3351cac6104affbe51dcc1716 /poi-ooxml/src/main/java
parenta46cf63f4f446371a6d499ff3d5397230c75a518 (diff)
downloadpoi-584c8c059b6b317178df635b37244c6e393d6c96.tar.gz
poi-584c8c059b6b317178df635b37244c6e393d6c96.zip
case insensitive map
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894720 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml/src/main/java')
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java16
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java8
2 files changed, 5 insertions, 19 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java
index 01317d0c75..c2c1f06cd2 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java
@@ -17,11 +17,10 @@
package org.apache.poi.xssf.usermodel;
-import java.util.HashMap;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
+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;
@@ -350,10 +349,6 @@ public abstract class BaseXSSFEvaluationWorkbook implements FormulaRenderingWork
return _uBook.createName();
}
- private static String caseInsensitive(String s) {
- return s.toUpperCase(Locale.ROOT);
- }
-
/*
* TODO: data tables are stored at the workbook level in XSSF, but are bound to a single sheet.
* The current code structure has them hanging off XSSFSheet, but formulas reference them
@@ -369,13 +364,11 @@ public abstract class BaseXSSFEvaluationWorkbook implements FormulaRenderingWork
if ( _tableCache != null ) {
return _tableCache;
}
- // FIXME: use org.apache.commons.collections.map.CaseInsensitiveMap
- _tableCache = new HashMap<>();
+ _tableCache = new CaseInsensitiveMap<>();
for (Sheet sheet : _uBook) {
for (XSSFTable tbl : ((XSSFSheet)sheet).getTables()) {
- String lname = caseInsensitive(tbl.getName());
- _tableCache.put(lname, tbl);
+ _tableCache.put(tbl.getName(), tbl);
}
}
return _tableCache;
@@ -394,8 +387,7 @@ public abstract class BaseXSSFEvaluationWorkbook implements FormulaRenderingWork
@Override
public XSSFTable getTable(String name) {
if (name == null) return null;
- String lname = caseInsensitive(name);
- return getTableCache().get(lname);
+ return getTableCache().get(name);
}
@Override
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java
index 1cff2e5f9c..39f45df8e3 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java
@@ -25,9 +25,7 @@ import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
-import java.util.Locale;
import org.apache.commons.collections4.map.CaseInsensitiveMap;
import org.apache.poi.ooxml.POIXMLDocumentPart;
@@ -817,10 +815,6 @@ public class XSSFTable extends POIXMLDocumentPart implements Table {
commonXPath = null;
}
- private static String caseInsensitive(String s) {
- return s.toUpperCase(Locale.ROOT);
- }
-
/**
* Gets the relative column index of a column in this table having the header name {@code column}.
* The column index is relative to the left-most column in the table, 0-indexed.
@@ -843,7 +837,7 @@ public class XSSFTable extends POIXMLDocumentPart implements Table {
int i = 0;
for (XSSFTableColumn column : getColumns()) {
String columnName = column.getName();
- columnMap.put(caseInsensitive(columnName), i);
+ columnMap.put(columnName, i);
i++;
}
}