From aef84b97f16c5bdae51a9e43f22223bf02aaa16e Mon Sep 17 00:00:00 2001 From: wuyiliang Date: Tue, 16 May 2023 19:46:23 +0800 Subject: [PATCH] [issue#3200]fix ClassCastException --- .../main/java/com/alibaba/excel/util/ClassUtils.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/easyexcel-core/src/main/java/com/alibaba/excel/util/ClassUtils.java b/easyexcel-core/src/main/java/com/alibaba/excel/util/ClassUtils.java index d2ac7135..f9a53e08 100644 --- a/easyexcel-core/src/main/java/com/alibaba/excel/util/ClassUtils.java +++ b/easyexcel-core/src/main/java/com/alibaba/excel/util/ClassUtils.java @@ -564,11 +564,13 @@ public class ClassUtils { FieldCacheKey(Class clazz, ConfigurationHolder configurationHolder) { this.clazz = clazz; - WriteHolder writeHolder = (WriteHolder)configurationHolder; - this.excludeColumnFieldNames = writeHolder.excludeColumnFieldNames(); - this.excludeColumnIndexes = writeHolder.excludeColumnIndexes(); - this.includeColumnFieldNames = writeHolder.includeColumnFieldNames(); - this.includeColumnIndexes = writeHolder.includeColumnIndexes(); + if (configurationHolder instanceof WriteHolder) { + WriteHolder writeHolder = (WriteHolder)configurationHolder; + this.excludeColumnFieldNames = writeHolder.excludeColumnFieldNames(); + this.excludeColumnIndexes = writeHolder.excludeColumnIndexes(); + this.includeColumnFieldNames = writeHolder.includeColumnFieldNames(); + this.includeColumnIndexes = writeHolder.includeColumnIndexes(); + } } }