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

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

commit 86c0ae60e129799a278fa4c92669d0cd5a269ee5
Author: Tilman Hausherr <til...@apache.org>
AuthorDate: Wed Aug 14 13:23:15 2024 +0200

    TIKA-4290: fix checkstyle issues, add override
---
 tika-core/src/main/java/org/apache/tika/mime/MagicMatch.java        | 6 +++++-
 .../src/main/java/org/apache/tika/parser/html/HtmlHandler.java      | 3 ++-
 .../src/main/java/org/apache/tika/parser/jdbc/JDBCTableReader.java  | 3 ++-
 .../main/java/org/apache/tika/parser/microsoft/OfficeParser.java    | 6 ++++--
 .../src/main/java/org/apache/tika/parser/txt/CharsetMatch.java      | 3 ++-
 .../src/main/java/org/apache/tika/parser/xml/FictionBookParser.java | 3 ++-
 6 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/tika-core/src/main/java/org/apache/tika/mime/MagicMatch.java 
b/tika-core/src/main/java/org/apache/tika/mime/MagicMatch.java
index 4917ea542..bb0b9e7fb 100644
--- a/tika-core/src/main/java/org/apache/tika/mime/MagicMatch.java
+++ b/tika-core/src/main/java/org/apache/tika/mime/MagicMatch.java
@@ -55,9 +55,11 @@ class MagicMatch implements Clause {
         return detector;
     }
 
+    @Override
     public boolean eval(byte[] data) {
         try {
-            return 
getDetector().detect(UnsynchronizedByteArrayInputStream.builder().setByteArray(data).get(),
 new Metadata()) !=
+            return getDetector().detect(
+                    
UnsynchronizedByteArrayInputStream.builder().setByteArray(data).get(), new 
Metadata()) !=
                     MediaType.OCTET_STREAM;
         } catch (IOException e) {
             // Should never happen with a ByteArrayInputStream
@@ -65,10 +67,12 @@ class MagicMatch implements Clause {
         }
     }
 
+    @Override
     public int size() {
         return getDetector().getLength();
     }
 
+    @Override
     public String toString() {
         return mediaType.toString() + " " + type + " " + offset + " " + value 
+ " " + mask;
     }
diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-html-module/src/main/java/org/apache/tika/parser/html/HtmlHandler.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-html-module/src/main/java/org/apache/tika/parser/html/HtmlHandler.java
index 17912125d..cb25f63a1 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-html-module/src/main/java/org/apache/tika/parser/html/HtmlHandler.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-html-module/src/main/java/org/apache/tika/parser/html/HtmlHandler.java
@@ -354,7 +354,8 @@ class HtmlHandler extends TextContentHandler {
         EmbeddedDocumentExtractor embeddedDocumentExtractor =
                 EmbeddedDocumentUtil.getEmbeddedDocumentExtractor(context);
         if (embeddedDocumentExtractor.shouldParseEmbedded(m)) {
-            try (InputStream stream = 
UnsynchronizedByteArrayInputStream.builder().setByteArray(string.getBytes(StandardCharsets.UTF_8)).get())
 {
+            try (InputStream stream = 
UnsynchronizedByteArrayInputStream.builder().
+                    
setByteArray(string.getBytes(StandardCharsets.UTF_8)).get()) {
                 embeddedDocumentExtractor.parseEmbedded(stream, xhtml, m, 
true);
             } catch (IOException e) {
                 EmbeddedDocumentUtil.recordEmbeddedStreamException(e, 
metadata);
diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-jdbc-commons/src/main/java/org/apache/tika/parser/jdbc/JDBCTableReader.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-jdbc-commons/src/main/java/org/apache/tika/parser/jdbc/JDBCTableReader.java
index 9df4d197d..66c6634f6 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-jdbc-commons/src/main/java/org/apache/tika/parser/jdbc/JDBCTableReader.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-jdbc-commons/src/main/java/org/apache/tika/parser/jdbc/JDBCTableReader.java
@@ -201,7 +201,8 @@ public class JDBCTableReader {
         String s = clob.getSubString(0, readSize);
         if (embeddedDocumentUtil.shouldParseEmbedded(m)) {
             embeddedDocumentUtil
-                    
.parseEmbedded(UnsynchronizedByteArrayInputStream.builder().setByteArray(s.getBytes(UTF_8)).get(),
 handler, m, true);
+                    
.parseEmbedded(UnsynchronizedByteArrayInputStream.builder().setByteArray(
+                            s.getBytes(UTF_8)).get(), handler, m, true);
         }
     }
 
diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/OfficeParser.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/OfficeParser.java
index c59e57072..9f491f80b 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/OfficeParser.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/OfficeParser.java
@@ -118,7 +118,8 @@ public class OfficeParser extends AbstractOfficeParser {
             if (embeddedDocumentExtractor.shouldParseEmbedded(m)) {
                 embeddedDocumentExtractor.parseEmbedded(
                         //pass in space character so that we don't trigger a 
zero-byte exception
-                        
UnsynchronizedByteArrayInputStream.builder().setByteArray(new 
byte[]{'\u0020'}).get(), xhtml, m, true);
+                        UnsynchronizedByteArrayInputStream.builder().
+                                setByteArray(new byte[]{'\u0020'}).get(), 
xhtml, m, true);
             }
             return;
         }
@@ -132,7 +133,8 @@ public class OfficeParser extends AbstractOfficeParser {
             }
             if (embeddedDocumentExtractor.shouldParseEmbedded(m)) {
                 embeddedDocumentExtractor.parseEmbedded(
-                        
UnsynchronizedByteArrayInputStream.builder().setByteArray(e.getValue().getBytes(StandardCharsets.UTF_8)).get(),
+                        UnsynchronizedByteArrayInputStream.builder().
+                                
setByteArray(e.getValue().getBytes(StandardCharsets.UTF_8)).get(),
                         xhtml, m, true);
             }
         }
diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-text-module/src/main/java/org/apache/tika/parser/txt/CharsetMatch.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-text-module/src/main/java/org/apache/tika/parser/txt/CharsetMatch.java
index beb56f394..cdbe934c3 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-text-module/src/main/java/org/apache/tika/parser/txt/CharsetMatch.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-text-module/src/main/java/org/apache/tika/parser/txt/CharsetMatch.java
@@ -100,7 +100,8 @@ public class CharsetMatch implements 
Comparable<CharsetMatch> {
 
         if (inputStream == null) {
             try {
-                inputStream = 
UnsynchronizedByteArrayInputStream.builder().setByteArray(fRawInput).setLength(fRawLength).get();
+                inputStream = UnsynchronizedByteArrayInputStream.builder().
+                        setByteArray(fRawInput).setLength(fRawLength).get();
             }
             catch (IOException ex) {
                 return null;
diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-xml-module/src/main/java/org/apache/tika/parser/xml/FictionBookParser.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-xml-module/src/main/java/org/apache/tika/parser/xml/FictionBookParser.java
index 4e7f0dad7..c83af0fd1 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-xml-module/src/main/java/org/apache/tika/parser/xml/FictionBookParser.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-xml-module/src/main/java/org/apache/tika/parser/xml/FictionBookParser.java
@@ -87,7 +87,8 @@ public class FictionBookParser extends XMLParser {
         public void endElement(String uri, String localName, String qName) 
throws SAXException {
             if (binaryMode) {
                 try (InputStream stream =
-                             
UnsynchronizedByteArrayInputStream.builder().setByteArray(Base64.decodeBase64(binaryData.toString())).get())
 {
+                             UnsynchronizedByteArrayInputStream.builder().
+                                     
setByteArray(Base64.decodeBase64(binaryData.toString())).get()) {
                     partExtractor.parseEmbedded(
                             stream, handler, metadata, true);
                 } catch (IOException e) {

Reply via email to