// ClassCastException in ZipFile now
// The relevant change in the JDK is http://hg.openjdk.java.net/jdk/jdk10/rev/85ea7e83af30#l5.66
- try (ZipFile thresholdInputStream = new ZipFile(XSSFTestDataSamples.getSampleFile("template.xlsx"))) {
+ try (ZipFile thresholdInputStream =
+ ZipFile.builder().setFile(XSSFTestDataSamples.getSampleFile("template.xlsx")).get()) {
try (ZipSecureFile secureFile = new ZipSecureFile(XSSFTestDataSamples.getSampleFile("template.xlsx"))) {
Enumeration<? extends ZipArchiveEntry> entries = thresholdInputStream.getEntries();
while (entries.hasMoreElements()) {
@Test
void test54764WithSAXHelper() throws Exception {
File testFile = XSSFTestDataSamples.getSampleFile("54764.xlsx");
- try (ZipFile zip = new ZipFile(testFile)) {
+ try (ZipFile zip = ZipFile.builder().setFile(testFile).get()) {
ZipArchiveEntry ze = zip.getEntry("xl/sharedStrings.xml");
XMLReader reader = XMLHelper.newXMLReader();
SAXParseException e = assertThrows(SAXParseException.class,
@Test
void test54764WithDocumentHelper() throws Exception {
File testFile = XSSFTestDataSamples.getSampleFile("54764.xlsx");
- try (ZipFile zip = new ZipFile(testFile)) {
+ try (ZipFile zip = ZipFile.builder().setFile(testFile).get()) {
ZipArchiveEntry ze = zip.getEntry("xl/sharedStrings.xml");
SAXParseException e = assertThrows(SAXParseException.class,
() -> DocumentHelper.readDocument(zip.getInputStream(ze)));
private static void readByCommonsCompress(File temp_excel_poi) throws IOException {
/* read by commons-compress*/
- try (ZipFile zipFile = new ZipFile(temp_excel_poi)) {
+ try (ZipFile zipFile = ZipFile.builder().setFile(temp_excel_poi).get()) {
ZipArchiveEntry entry = zipFile.getEntry("xl/workbook.xml");
InputStream inputStream = zipFile.getInputStream(entry);