From 2989ab10191e9313affe4fe32a4f8834abd0b772 Mon Sep 17 00:00:00 2001 From: yuwen Date: Sat, 30 Jan 2021 16:52:55 +0800 Subject: [PATCH] =?UTF-8?q?fix.=E5=A4=84=E7=90=86=E7=A9=BA=E5=80=BC?= =?UTF-8?q?=E4=B8=8D=E5=8F=97=E6=8C=87=E5=AE=9Aconverter=E5=A4=84=E7=90=86?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../excel/write/executor/AbstractExcelWriteExecutor.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/alibaba/excel/write/executor/AbstractExcelWriteExecutor.java b/src/main/java/com/alibaba/excel/write/executor/AbstractExcelWriteExecutor.java index 4eb115c5..9e7ade6c 100644 --- a/src/main/java/com/alibaba/excel/write/executor/AbstractExcelWriteExecutor.java +++ b/src/main/java/com/alibaba/excel/write/executor/AbstractExcelWriteExecutor.java @@ -32,9 +32,6 @@ public abstract class AbstractExcelWriteExecutor implements ExcelWriteExecutor { protected CellData converterAndSet(WriteHolder currentWriteHolder, Class clazz, Cell cell, Object value, ExcelContentProperty excelContentProperty, Head head, Integer relativeRowIndex) { - if (value == null) { - return new CellData(CellDataTypeEnum.EMPTY); - } if (value instanceof String && currentWriteHolder.globalConfiguration().getAutoTrim()) { value = ((String)value).trim(); } @@ -70,9 +67,6 @@ public abstract class AbstractExcelWriteExecutor implements ExcelWriteExecutor { protected CellData convert(WriteHolder currentWriteHolder, Class clazz, Cell cell, Object value, ExcelContentProperty excelContentProperty) { - if (value == null) { - return new CellData(CellDataTypeEnum.EMPTY); - } // This means that the user has defined the data. if (value instanceof CellData) { CellData cellDataValue = (CellData)value; @@ -103,6 +97,9 @@ public abstract class AbstractExcelWriteExecutor implements ExcelWriteExecutor { converter = excelContentProperty.getConverter(); } if (converter == null) { + if (value == null || clazz == null) { + return new CellData(CellDataTypeEnum.EMPTY); + } converter = currentWriteHolder.converterMap().get(ConverterKeyBuild.buildKey(clazz)); } if (converter == null) {