Это мой исходный код Java
@Value("classpath:Metadata.xlsx")
private Resource resource;
public E2EMetadata readMetadata(E2ECommandContext commandContext) {
E2EMetadata metadata = new E2EMetadata();
try {
Workbook metadataWorkbook = null;
metadataWorkbook = WorkbookFactory.create(resource.getInputStream());
List<OutputFileType> outputFileTypes = readOutputFilesMetadataSheet(metadataWorkbook);
List<InputFileType> inputFileTypes = readInputFilesMetadataSheet(metadataWorkbook);
metadata.setOutputFileTypes(outputFileTypes);
metadata.setInputFileTypes(inputFileTypes);
metadataWorkbook.close();
} catch (Exception e) {
throw new TestingToolsRuntimeException(e);
}
return metadata;
}
Здесь, пока WorkbookFactory.create (resource.getInputStream ()) выдает исключение ZipException
Caused by: java.io.IOException: Failed to read zip entry source
at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:103)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:324)
at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:184)
at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:149)
at com.zafin.rpe.test.tools.MetadataReader.readMetadata(MetadataReader.java:36)
... 34 more
Caused by: java.util.zip.ZipException: invalid entry size (expected 1936483698 but got 1 bytes)
at java.util.zip.ZipInputStream.readEnd(ZipInputStream.java:384)
at java.util.zip.ZipInputStream.read(ZipInputStream.java:196)
at org.apache.poi.openxml4j.util.ZipSecureFile$ThresholdInputStream.read(ZipSecureFile.java:220)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
at org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource$FakeZipEntry.<init>(ZipInputStreamZipEntrySource.java:132)
at org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource.<init>(ZipInputStreamZipEntrySource.java:56)
at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:100)
В чем причина этого исключения zipexception? моя версия apache poi - 3.17