I am using Apache POI for reading xsl files. My pom file update:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.0</version>
</dependency>
My code:
public List<String> getSheetNames(String fileLocation) throws Exception {
FileInputStream file = new FileInputStream(new File(fileLocation));
Workbook workbook = null;
try {
workbook = new XSSFWorkbook(file);
} catch (Exception e) {
e.printStackTrace();
}
//do something with read lines
}
This works fine for some files. However, for others it throws this error:
org.apache.commons.compress.archivers.zip.UnsupportedZipFeatureException: Unsupported feature compression method used in entry ... ... at org.apache.commons.compress.archivers.zip.ZipUtil.checkRequestedFeatures(ZipUtil.java:353) at org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.java:514) at java.io.FilterInputStream.read(FilterInputStream.java:133) at org.apache.poi.openxml4j.util.ZipArchiveThresholdInputStream.read(ZipArchiveThresholdInputStream.java:80) at org.apache.poi.util.IOUtils.toByteArray(IOUtils.java:185) at org.apache.poi.util.IOUtils.toByteArray(IOUtils.java:153) at org.apache.poi.util.IOUtils.toByteArray(IOUtils.java:140) at org.apache.poi.openxml4j.util.ZipArchiveFakeEntry.(ZipArchiveFakeEntry.java:72) at org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource.(ZipInputStreamZipEntrySource.java:98) at org.apache.poi.openxml4j.opc.ZipPackage.(ZipPackage.java:132) at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:312) at org.apache.poi.ooxml.util.PackageHelper.open(PackageHelper.java:59) at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:304) at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:300)
what's the fix for this error? I haven't been able to find much help online.
UPDATE: This is not working for any file now.