今天在使用Hutool操作Excel的时候,出现了一个问题,导致操作失败。
错误原因如下:
cn.hutool.poi.exceptions.POIException: IOException: Zip bomb detected! The file would exceed the max. ratio of compressed file size to the size of the expanded data.
This may indicate that the file is used to inflate memory usage and thus could pose a security risk.
You can adjust this limit via ZipSecureFile.setMinInflateRatio() if you need to work with files which exceed this limit.
Uncompressed size: 158224, Raw/compressed size: 1572, ratio: 0.009935
Limits: MIN_INFLATE_RATIO: 0.010000, Entry: xl/styles.xml
at cn.hutool.poi.excel.WorkbookUtil.createBook(WorkbookUtil.java:148)
at cn.hutool.poi.excel.WorkbookUtil.createBook(WorkbookUtil.java:133)
at cn.hutool.poi.excel.WorkbookUtil.createBookForWriter(WorkbookUtil.java:92)
at cn.hutool.poi.excel.ExcelWriter.<init>(ExcelWriter.java:158)
at cn.hutool.poi.excel.ExcelWriter.<init>(ExcelWriter.java:139)
at cn.hutool.poi.excel.ExcelWriter.<init>(ExcelWriter.java:116)
at cn.hutool.poi.excel.ExcelUtil.getWriter(ExcelUtil.java:289)
at com.ppgod.common.kf.OpenDataReport.writeAllData(OpenDataReport.java:370)
at com.ppgod.common.kf.OpenDataReport.testIneTableName(OpenDataReport.java:230)
at com.ppgod.common.kf.OpenDataReport.writeExcel(OpenDataReport.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$Refl