This is an automated email from the ASF dual-hosted git repository.

tilman pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika.git

commit 5909b3d56c8a6fa3d2115ea66cb172c98714b6ca
Author: Tilman Hausherr <til...@apache.org>
AuthorDate: Sat Aug 10 14:32:50 2024 +0200

    TIKA-4290: replace deprecated
---
 .../src/main/java/org/apache/tika/parser/epub/EpubParser.java       | 6 +++---
 .../src/main/java/org/apache/tika/parser/wacz/WACZParser.java       | 4 ++--
 .../test/java/org/apache/tika/config/TikaDetectorConfigTest.java    | 2 +-
 .../src/test/java/org/apache/tika/mime/OneOffMimeTest.java          | 2 +-
 .../apache/tika/parser/pkg/CompositeZipContainerDetectorTest.java   | 6 +++---
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-miscoffice-module/src/main/java/org/apache/tika/parser/epub/EpubParser.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-miscoffice-module/src/main/java/org/apache/tika/parser/epub/EpubParser.java
index e6d7e73b8..9cb820a52 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-miscoffice-module/src/main/java/org/apache/tika/parser/epub/EpubParser.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-miscoffice-module/src/main/java/org/apache/tika/parser/epub/EpubParser.java
@@ -153,7 +153,7 @@ public class EpubParser implements Parser {
             throws IOException, TikaException, SAXException {
         ZipArchiveInputStream zip = new ZipArchiveInputStream(stream, "UTF-8", 
false, true, false);
 
-        ZipArchiveEntry entry = zip.getNextZipEntry();
+        ZipArchiveEntry entry = zip.getNextEntry();
         SAXException sax = null;
         while (entry != null) {
             if (entry.getName().equals("mimetype")) {
@@ -178,7 +178,7 @@ public class EpubParser implements Parser {
                     }
                 }
             }
-            entry = zip.getNextZipEntry();
+            entry = zip.getNextEntry();
         }
         if (sax != null) {
             throw sax;
@@ -215,7 +215,7 @@ public class EpubParser implements Parser {
         }
         ZipFile zipFile = null;
         try {
-            zipFile = zipFile = 
ZipFile.builder().setFile(tis.getPath().toFile()).get();
+            zipFile = ZipFile.builder().setFile(tis.getPath().toFile()).get();
         } catch (IOException e) {
             ParserUtils.recordParserFailure(this, e, metadata);
             return trySalvage(tis.getPath(), bodyHandler, xhtml, metadata, 
context);
diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-webarchive-module/src/main/java/org/apache/tika/parser/wacz/WACZParser.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-webarchive-module/src/main/java/org/apache/tika/parser/wacz/WACZParser.java
index 4f1922314..e78511f2b 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-webarchive-module/src/main/java/org/apache/tika/parser/wacz/WACZParser.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-webarchive-module/src/main/java/org/apache/tika/parser/wacz/WACZParser.java
@@ -87,7 +87,7 @@ public class WACZParser implements Parser {
                                EmbeddedDocumentExtractor ex) throws 
SAXException, IOException {
         try (ZipArchiveInputStream zais = new ZipArchiveInputStream(
                 CloseShieldInputStream.wrap(stream))) {
-            ZipArchiveEntry zae = zais.getNextZipEntry();
+            ZipArchiveEntry zae = zais.getNextEntry();
             while (zae != null) {
                 String name = zae.getName();
                 if (name.startsWith("archive/")) {
@@ -99,7 +99,7 @@ public class WACZParser implements Parser {
                 }
                 //TODO -- process pages (jsonl); process indexes?!
 
-                zae = zais.getNextZipEntry();
+                zae = zais.getNextEntry();
             }
         }
     }
diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/config/TikaDetectorConfigTest.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/config/TikaDetectorConfigTest.java
index fc573a8f0..9473c6035 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/config/TikaDetectorConfigTest.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/config/TikaDetectorConfigTest.java
@@ -109,7 +109,7 @@ public class TikaDetectorConfigTest extends 
AbstractTikaConfigTest {
         // Now check they detect PST files correctly
         try (TikaInputStream outer = TikaInputStream
                 .get(getResourceAsStream("/test-documents/testPST.pst"))) {
-            try (TikaInputStream stream = 
TikaInputStream.get(outer.getFile())) {
+            try (TikaInputStream stream = 
TikaInputStream.get(outer.getPath())) {
 
                 assertEquals(OutlookPSTParser.MS_OUTLOOK_PST_MIMETYPE,
                         detectorWX.detect(stream, new Metadata()));
diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/mime/OneOffMimeTest.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/mime/OneOffMimeTest.java
index fb0ad4b54..f5aecbe68 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/mime/OneOffMimeTest.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/mime/OneOffMimeTest.java
@@ -67,7 +67,7 @@ public class OneOffMimeTest extends TikaTest {
         Metadata metadata = new Metadata();
         metadata.set(TikaCoreProperties.RESOURCE_NAME_KEY, 
p.getFileName().toString());
         assertEquals(expected,
-                getRecursiveMetadata(new 
UnsynchronizedByteArrayInputStream(new byte[0]),
+                
getRecursiveMetadata(UnsynchronizedByteArrayInputStream.builder().setByteArray(new
 byte[0]).get(),
                         metadata,
                         new ParseContext(), 
true).get(0).get(Metadata.CONTENT_TYPE));
     }
diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/parser/pkg/CompositeZipContainerDetectorTest.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/parser/pkg/CompositeZipContainerDetectorTest.java
index cba520834..710f947c3 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/parser/pkg/CompositeZipContainerDetectorTest.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/parser/pkg/CompositeZipContainerDetectorTest.java
@@ -150,7 +150,7 @@ public class CompositeZipContainerDetectorTest extends 
TikaTest {
                 tikaStream += System.currentTimeMillis() - start;
 
                 start = System.currentTimeMillis();
-                try (InputStream is = TikaInputStream.get(z)) {
+                try (InputStream is = TikaInputStream.get(z.toPath())) {
                     MediaType mt = detector.detect(is, new Metadata());
                     mediaTypeSet.add(mt);
                 }
@@ -189,7 +189,7 @@ public class CompositeZipContainerDetectorTest extends 
TikaTest {
                 }
                 tikaStream += System.currentTimeMillis() - start;
                 start = System.currentTimeMillis();
-                try (InputStream is = TikaInputStream.get(z)) {
+                try (InputStream is = TikaInputStream.get(z.toPath())) {
                     getRecursiveMetadata(is, true);
                 }
                 tikaStreamWFile += System.currentTimeMillis() - start;
@@ -207,7 +207,7 @@ public class CompositeZipContainerDetectorTest extends 
TikaTest {
             throws Exception {
         List<File> zips = new ArrayList<>();
         for (File f : 
Paths.get(getResourceAsUri("/test-documents")).toFile().listFiles()) {
-            try (InputStream is = TikaInputStream.get(f)) {
+            try (InputStream is = TikaInputStream.get(f.toPath())) {
                 MediaType mt = detector.detect(is, new Metadata());
                 if (registry.isSpecializationOf(mt, 
MediaType.APPLICATION_ZIP)) {
                     zips.add(f);

Reply via email to