This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git
The following commit(s) were added to refs/heads/trunk by this push:
new 2b7f7074a0 refactor getTableStyle due to perf issues (#896)
2b7f7074a0 is described below
commit 2b7f7074a0b176948cbe3f5a4a4e80a13137a8cc
Author: PJ Fanning <[email protected]>
AuthorDate: Tue Sep 9 23:12:08 2025 +0100
refactor getTableStyle due to perf issues (#896)
---
.../src/main/java/org/apache/poi/xssf/model/StylesTable.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/model/StylesTable.java
b/poi-ooxml/src/main/java/org/apache/poi/xssf/model/StylesTable.java
index 3201544192..99a9e37756 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/model/StylesTable.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/model/StylesTable.java
@@ -841,14 +841,15 @@ public class StylesTable extends POIXMLDocumentPart
implements Styles {
* @return defined style, either explicit or built-in, or null if not found
*
* @since 3.17 beta 1
+ * @throws IllegalArgumentException if there is no explicit table style
but the name is an
+ * unknown built-in style
*/
public TableStyle getTableStyle(String name) {
if (name == null) return null;
- try {
- return XSSFBuiltinTableStyle.valueOf(name).getStyle();
- } catch (IllegalArgumentException e) {
- return getExplicitTableStyle(name);
- }
+ TableStyle tableStyle = getExplicitTableStyle(name);
+ if (tableStyle == null)
+ tableStyle = XSSFBuiltinTableStyle.valueOf(name).getStyle();
+ return tableStyle;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]