You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2021/11/03 15:20:32 UTC
svn commit: r1894720 - in
/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel:
BaseXSSFEvaluationWorkbook.java XSSFTable.java
Author: fanningpj
Date: Wed Nov 3 15:20:32 2021
New Revision: 1894720
URL: http://svn.apache.org/viewvc?rev=1894720&view=rev
Log:
case insensitive map
Modified:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java
Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java?rev=1894720&r1=1894719&r2=1894720&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java Wed Nov 3 15:20:32 2021
@@ -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 BaseXSSFEvaluation
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 BaseXSSFEvaluation
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 BaseXSSFEvaluation
@Override
public XSSFTable getTable(String name) {
if (name == null) return null;
- String lname = caseInsensitive(name);
- return getTableCache().get(lname);
+ return getTableCache().get(name);
}
@Override
Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java?rev=1894720&r1=1894719&r2=1894720&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java Wed Nov 3 15:20:32 2021
@@ -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 POIXMLDoc
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 POIXMLDoc
int i = 0;
for (XSSFTableColumn column : getColumns()) {
String columnName = column.getName();
- columnMap.put(caseInsensitive(columnName), i);
+ columnMap.put(columnName, i);
i++;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org