From 8a4496b3af10fe88896571e14d0befb44652090b Mon Sep 17 00:00:00 2001 From: Looly Date: Thu, 27 Apr 2023 18:49:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96Sax=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E6=97=B6=E7=A9=BA=E7=99=BD=E8=A1=8C=E8=BF=94?= =?UTF-8?q?=E5=9B=9E0=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=B8=BA=E8=BF=94?= =?UTF-8?q?=E5=9B=9E-1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + .../java/cn/hutool/poi/excel/sax/SheetDataSaxHandler.java | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9c8e84e1..78d91904e 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### 🐣新特性 * 【db 】 优化HttpRequest.toString()内容打印(issue#3072@Github) +* 【poi 】 优化Sax方式读取时空白行返回0,修改为返回-1(issue#I6WYF6@Gitee) ### 🐞Bug修复 * 【core 】 修复URLUtil.decode无法解码UTF-16问题(issue#3063@Github) diff --git a/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/SheetDataSaxHandler.java b/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/SheetDataSaxHandler.java index 5d61bde85..a2734d819 100644 --- a/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/SheetDataSaxHandler.java +++ b/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/SheetDataSaxHandler.java @@ -172,9 +172,8 @@ public class SheetDataSaxHandler extends DefaultHandler { */ private void startRow(Attributes attributes) { final String rValue = AttributeName.r.getValue(attributes); - if (null != rValue) { - this.rowNumber = Long.parseLong(rValue) - 1; - } + // https://gitee.com/dromara/hutool/issues/I6WYF6 + this.rowNumber = (null == rValue) ? -1 : Long.parseLong(rValue) - 1; } /**