Browse Source

Merge pull request #1995 from seven4x/bugfix

initSheet catch exception避免哑处理异常输出错误日志便于异常排错
developing
Jiaju Zhuang 3 years ago committed by GitHub
parent
commit
d3cf3e5033
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/main/java/com/alibaba/excel/context/WriteContextImpl.java

7
src/main/java/com/alibaba/excel/context/WriteContextImpl.java

@ -179,12 +179,9 @@ public class WriteContextImpl implements WriteContext {
writeSheetHolder writeSheetHolder
.setCachedSheet(writeWorkbookHolder.getCachedWorkbook().getSheet(writeSheetHolder.getSheetName())); .setCachedSheet(writeWorkbookHolder.getCachedWorkbook().getSheet(writeSheetHolder.getSheetName()));
} }
} catch (IllegalArgumentException e) { } catch (Exception e) {
if (e.getMessage() != null && e.getMessage().contains(NO_SHEETS)) { LOGGER.error("initSheet exception ",e);
currentSheet = createSheet(); currentSheet = createSheet();
} else {
throw e;
}
} }
if (currentSheet == null) { if (currentSheet == null) {
currentSheet = createSheet(); currentSheet = createSheet();

Loading…
Cancel
Save