Reduce testcase some more, add missing license header
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1825851 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
feace0e745
commit
ff96f4c64d
@ -1,13 +1,28 @@
|
|||||||
|
/* ====================================================================
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
|
this work for additional information regarding copyright ownership.
|
||||||
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
(the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
==================================================================== */
|
||||||
package org.apache.poi.openxml4j.util;
|
package org.apache.poi.openxml4j.util;
|
||||||
|
|
||||||
import org.apache.poi.openxml4j.opc.internal.ZipHelper;
|
|
||||||
import org.apache.poi.xssf.XSSFTestDataSamples;
|
import org.apache.poi.xssf.XSSFTestDataSamples;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
@ -16,12 +31,13 @@ public class TestZipSecureFile {
|
|||||||
public void testThresholdInputStream() throws Exception {
|
public void testThresholdInputStream() throws Exception {
|
||||||
// This fails in Java 10 because our reflection injection of the ThresholdInputStream causes a
|
// This fails in Java 10 because our reflection injection of the ThresholdInputStream causes a
|
||||||
// ClassCastException in ZipFile now
|
// ClassCastException in ZipFile now
|
||||||
ZipSecureFile.ThresholdInputStream zis = ZipHelper.openZipStream(new FileInputStream(XSSFTestDataSamples.getSampleFile("template.xlsx")));
|
// The relevant change in the JDK is http://hg.openjdk.java.net/jdk/jdk10/rev/85ea7e83af30#l5.66
|
||||||
ZipInputStreamZipEntrySource thresholdInputStream = new ZipInputStreamZipEntrySource(zis);
|
|
||||||
|
ZipFile thresholdInputStream = new ZipFile(XSSFTestDataSamples.getSampleFile("template.xlsx"));
|
||||||
|
|
||||||
ZipSecureFile secureFile = new ZipSecureFile(XSSFTestDataSamples.getSampleFile("template.xlsx"));
|
ZipSecureFile secureFile = new ZipSecureFile(XSSFTestDataSamples.getSampleFile("template.xlsx"));
|
||||||
|
|
||||||
Enumeration<? extends ZipEntry> entries = thresholdInputStream.getEntries();
|
Enumeration<? extends ZipEntry> entries = thresholdInputStream.entries();
|
||||||
while (entries.hasMoreElements()) {
|
while (entries.hasMoreElements()) {
|
||||||
ZipEntry entry = entries.nextElement();
|
ZipEntry entry = entries.nextElement();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user