You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ti...@apache.org on 2024/08/10 04:36:07 UTC

(tika) branch main updated: TIKA-4290: replace deprecated, add override

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


The following commit(s) were added to refs/heads/main by this push:
     new 3dbb7c354 TIKA-4290: replace deprecated, add override
3dbb7c354 is described below

commit 3dbb7c35420c163e79081811338bf6c8000a3b4f
Author: Tilman Hausherr <ti...@apache.org>
AuthorDate: Sat Aug 10 06:35:57 2024 +0200

    TIKA-4290: replace deprecated, add override
---
 tika-core/src/main/java/org/apache/tika/mime/MimeTypes.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tika-core/src/main/java/org/apache/tika/mime/MimeTypes.java b/tika-core/src/main/java/org/apache/tika/mime/MimeTypes.java
index 10ef6cbc7..f961e8ee0 100644
--- a/tika-core/src/main/java/org/apache/tika/mime/MimeTypes.java
+++ b/tika-core/src/main/java/org/apache/tika/mime/MimeTypes.java
@@ -292,7 +292,8 @@ public final class MimeTypes implements Detector, Serializable {
         // Finally, assume plain text if no control bytes are found
         try {
             TextDetector detector = new TextDetector(getMinLength());
-            UnsynchronizedByteArrayInputStream stream = new UnsynchronizedByteArrayInputStream(data);
+            UnsynchronizedByteArrayInputStream stream =
+                    UnsynchronizedByteArrayInputStream.builder().setByteArray(data).get();
             MimeType type = forName(detector.detect(stream, new Metadata()).toString());
             return Collections.singletonList(type);
         } catch (Exception e) {
@@ -515,6 +516,7 @@ public final class MimeTypes implements Detector, Serializable {
      * @return MIME type of the document
      * @throws IOException if the document stream could not be read
      */
+    @Override
     public MediaType detect(InputStream input, Metadata metadata) throws IOException {
         List<MimeType> possibleTypes = null;