在使用Apache POI处理Excel文件时遇到了'java.io.IOException: Zip bomb detected!'错误,该异常指出文件压缩比例超过了最大限制。通过设置ZipSecureFile.setMinInflateRatio(-1.0d)虽然能避免报错,但会导致读取的Excel值为null。解决方法是复制不受保护的Excel文件进行读取。
java.io.IOException: Zip bomb detected! The file would exceed the max. ratio of compressed file size to the size of the expanded data.
1、使用poi导入excel文件时碰到如下问题
java.io.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:1935318, Raw/compressed size:19345, ratio:0.009996
Limits: MIN_INFLATE_RATIO:0.010000, Entry: xl/pivotCache/pivotCacheRecords1.xml
at org.apache.poi.openxml4j.util.ZipArchiveThresholdInputStream.checkThreshold(ZipArchiveThresholdInputStream.java:130)
at org