From 30e1eb929c218335d35fa7965f546eb9986c172b Mon Sep 17 00:00:00 2001 From: Looly Date: Wed, 9 Dec 2020 00:08:12 +0800 Subject: [PATCH] fix bugs --- CHANGELOG.md | 2 + .../main/java/cn/hutool/db/sql/Wrapper.java | 3 +- .../poi/excel/sax/Excel07SaxReader.java | 42 ++++++++++++++++--- .../cn/hutool/poi/excel/ExcelSaxReadTest.java | 8 ++++ 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65dd28373..d45f0d7e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ * 【core 】 修复TemporalAccessorUtil无法格式化LocalDate带时间问题(issue#1289@Github) * 【json 】 修复自定义日期格式的LocalDateTime没有包装引号问题(issue#1289@Github) * 【cache 】 get中unlock改为unlockRead(issue#1294@Github) +* 【db 】 修复表名包含点导致的问题(issue#1300@Github) +* 【poi 】 修复xdr:row标签导致的问题(issue#1297@Github) ------------------------------------------------------------------------------------------------------------- diff --git a/hutool-db/src/main/java/cn/hutool/db/sql/Wrapper.java b/hutool-db/src/main/java/cn/hutool/db/sql/Wrapper.java index 525fcc5a2..4f6f8d4f8 100644 --- a/hutool-db/src/main/java/cn/hutool/db/sql/Wrapper.java +++ b/hutool-db/src/main/java/cn/hutool/db/sql/Wrapper.java @@ -1,5 +1,6 @@ package cn.hutool.db.sql; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.lang.Editor; import cn.hutool.core.util.ArrayUtil; @@ -98,7 +99,7 @@ public class Wrapper { //对于Oracle这类数据库,表名中包含用户名需要单独拆分包装 if(field.contains(StrUtil.DOT)){ - final Collection target = CollectionUtil.filter(StrUtil.split(field, StrUtil.C_DOT), (Editor) t -> StrUtil.format("{}{}{}", preWrapQuote, t, sufWrapQuote)); + final Collection target = CollUtil.filter(StrUtil.split(field, StrUtil.C_DOT, 2), (Editor) t -> StrUtil.format("{}{}{}", preWrapQuote, t, sufWrapQuote)); return CollectionUtil.join(target, StrUtil.DOT); } diff --git a/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel07SaxReader.java b/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel07SaxReader.java index 2fb116468..9ed1ca7aa 100644 --- a/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel07SaxReader.java +++ b/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel07SaxReader.java @@ -66,6 +66,8 @@ public class Excel07SaxReader extends DefaultHandler implements ExcelSaxReader 0) { - addCellValue(curCell++, ""); + addCellValue(curCell++, StrUtil.EMPTY); } } } diff --git a/hutool-poi/src/test/java/cn/hutool/poi/excel/ExcelSaxReadTest.java b/hutool-poi/src/test/java/cn/hutool/poi/excel/ExcelSaxReadTest.java index 3407be109..4b07c60af 100644 --- a/hutool-poi/src/test/java/cn/hutool/poi/excel/ExcelSaxReadTest.java +++ b/hutool-poi/src/test/java/cn/hutool/poi/excel/ExcelSaxReadTest.java @@ -175,4 +175,12 @@ public class ExcelSaxReadTest { ExcelUtil.getReader(file).read().forEach(Console::log); } + + @Test + @Ignore + public void readXlsmTest(){ + ExcelUtil.readBySax("d:/test/WhiteListTemplate.xlsm", -1, (sheetIndex, rowIndex, rowlist) -> { + Console.log("[{}] [{}] {}", sheetIndex, rowIndex, rowlist); + }); + } }