mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
ZipFile deprecation warnings
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918179 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
41ccb6fe30
commit
ca64f86ff8
@ -64,7 +64,7 @@ public final class AesZipFileZipEntrySource implements ZipEntrySource {
|
||||
|
||||
private AesZipFileZipEntrySource(File tmpFile, Cipher ci) throws IOException {
|
||||
this.tmpFile = tmpFile;
|
||||
this.zipFile = new ZipFile(tmpFile);
|
||||
this.zipFile = ZipFile.builder().setFile(tmpFile).get();
|
||||
this.ci = ci;
|
||||
this.closed = false;
|
||||
}
|
||||
|
||||
@ -34,7 +34,8 @@ class TestZipSecureFile {
|
||||
// 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()) {
|
||||
|
||||
@ -1887,7 +1887,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||
@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,
|
||||
@ -1900,7 +1900,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||
@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)));
|
||||
@ -3908,7 +3908,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||
|
||||
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);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user