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

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


The following commit(s) were added to refs/heads/branch_3x by this push:
     new 1d40f78d2 TIKA-4455: replace deprecated
1d40f78d2 is described below

commit 1d40f78d2a076ec11faf173cc94d724a95c8bade
Author: Tilman Hausherr <[email protected]>
AuthorDate: Sat Aug 16 18:45:04 2025 +0200

    TIKA-4455: replace deprecated
---
 .../main/java/org/apache/tika/eval/app/ExtractComparer.java   | 10 +++++-----
 .../main/java/org/apache/tika/eval/app/ExtractProfiler.java   | 10 +++++-----
 .../src/main/java/org/apache/tika/eval/app/FileProfiler.java  | 10 +++++-----
 .../org/apache/tika/eval/app/reports/ResultsReporter.java     | 11 +++++------
 .../main/java/org/apache/tika/server/core/TikaServerCli.java  |  9 +++++----
 5 files changed, 25 insertions(+), 25 deletions(-)

diff --git 
a/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractComparer.java
 
b/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractComparer.java
index 6f2865bf0..cc9624383 100644
--- 
a/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractComparer.java
+++ 
b/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractComparer.java
@@ -26,9 +26,9 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ArrayBlockingQueue;
 
-import org.apache.commons.cli.HelpFormatter;
 import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
+import org.apache.commons.cli.help.HelpFormatter;
 import org.apache.commons.io.FilenameUtils;
 
 import org.apache.tika.batch.FileResource;
@@ -126,10 +126,10 @@ public class ExtractComparer extends AbstractProfiler {
         this.extractReader = extractReader;
     }
 
-    public static void USAGE() {
-        HelpFormatter helpFormatter = new HelpFormatter();
-        helpFormatter.printHelp(80, "java -jar tika-eval-x.y.jar Compare 
-extractsA extractsA -extractsB extractsB -db mydb", "Tool: Compare", 
ExtractComparer.OPTIONS,
-                "Note: for the default h2 db, do not include the .mv.db at the 
end of the db name.");
+    public static void USAGE() throws IOException {
+        HelpFormatter helpFormatter = HelpFormatter.builder().get();
+        helpFormatter.printHelp("java -jar tika-eval-x.y.jar Compare 
-extractsA extractsA -extractsB extractsB -db mydb", "Tool: Compare", 
ExtractComparer.OPTIONS, 
+                "Note: for the default h2 db, do not include the .mv.db at the 
end of the db name.", true);
     }
 
     @Override
diff --git 
a/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractProfiler.java
 
b/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractProfiler.java
index 22889d73b..75e253a33 100644
--- 
a/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractProfiler.java
+++ 
b/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractProfiler.java
@@ -24,9 +24,9 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ArrayBlockingQueue;
 
-import org.apache.commons.cli.HelpFormatter;
 import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
+import org.apache.commons.cli.help.HelpFormatter;
 
 import org.apache.tika.batch.FileResource;
 import org.apache.tika.eval.app.db.ColInfo;
@@ -119,10 +119,10 @@ public class ExtractProfiler extends AbstractProfiler {
         this.extractReader = extractReader;
     }
 
-    public static void USAGE() {
-        HelpFormatter helpFormatter = new HelpFormatter();
-        helpFormatter.printHelp(80, "java -jar tika-eval-x.y.jar Profile 
-extracts extracts -db mydb [-inputDir input]", "Tool: Profile", 
ExtractProfiler.OPTIONS,
-                "Note: for the default h2 db, do not include the .mv.db at the 
end of the db name.");
+    public static void USAGE() throws IOException {
+        HelpFormatter helpFormatter = HelpFormatter.builder().get();
+        helpFormatter.printHelp("java -jar tika-eval-x.y.jar Profile -extracts 
extracts -db mydb [-inputDir input]", "Tool: Profile", ExtractProfiler.OPTIONS, 
+                "Note: for the default h2 db, do not include the .mv.db at the 
end of the db name.", true);
     }
 
     @Override
diff --git 
a/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/FileProfiler.java
 
b/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/FileProfiler.java
index 925452094..f8d5cdb7e 100644
--- 
a/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/FileProfiler.java
+++ 
b/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/FileProfiler.java
@@ -25,9 +25,9 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ArrayBlockingQueue;
 
-import org.apache.commons.cli.HelpFormatter;
 import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
+import org.apache.commons.cli.help.HelpFormatter;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.io.FilenameUtils;
 import org.slf4j.Logger;
@@ -101,10 +101,10 @@ public class FileProfiler extends AbstractProfiler {
         this.inputDir = inputDir;
     }
 
-    public static void USAGE() {
-        HelpFormatter helpFormatter = new HelpFormatter();
-        helpFormatter.printHelp(80, "java -jar tika-eval-x.y.jar FileProfiler 
-inputDir docs -db mydb [-inputDir input]", "Tool: Profile", 
FileProfiler.OPTIONS,
-                "Note: for the default h2 db, do not include the .mv.db at the 
end of the db name.");
+    public static void USAGE() throws IOException {
+        HelpFormatter helpFormatter = HelpFormatter.builder().get();
+        helpFormatter.printHelp("java -jar tika-eval-x.y.jar FileProfiler 
-inputDir docs -db mydb [-inputDir input]", "Tool: Profile", 
FileProfiler.OPTIONS, 
+                "Note: for the default h2 db, do not include the .mv.db at the 
end of the db name.", true);
     }
 
     @Override
diff --git 
a/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/reports/ResultsReporter.java
 
b/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/reports/ResultsReporter.java
index 0abee4c35..bf8359302 100644
--- 
a/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/reports/ResultsReporter.java
+++ 
b/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/reports/ResultsReporter.java
@@ -36,9 +36,9 @@ import javax.xml.parsers.DocumentBuilder;
 
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.DefaultParser;
-import org.apache.commons.cli.HelpFormatter;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
+import org.apache.commons.cli.help.HelpFormatter;
 import org.apache.poi.common.usermodel.HyperlinkType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -76,11 +76,10 @@ public class ResultsReporter {
     List<String> after = new ArrayList<>();
     List<Report> reports = new ArrayList<>();
 
-    public static void USAGE() {
-        HelpFormatter helpFormatter = new HelpFormatter();
-        helpFormatter.printHelp(80, "java -jar tika-eval-x.y.jar Report -db 
mydb [-rd myreports] [-rf myreports.xml]", "Tool: Report", 
ResultsReporter.OPTIONS,
-                "Note: for h2 db, do not include the .mv.db at the end of the 
db name.");
-
+    public static void USAGE() throws IOException {
+        HelpFormatter helpFormatter = HelpFormatter.builder().get();
+        helpFormatter.printHelp("java -jar tika-eval-x.y.jar Report -db mydb 
[-rd myreports] [-rf myreports.xml]", "Tool: Report", ResultsReporter.OPTIONS,
+                "Note: for h2 db, do not include the .mv.db at the end of the 
db name.", true);
     }
 
     public static ResultsReporter build(Path p) throws Exception {
diff --git 
a/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/TikaServerCli.java
 
b/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/TikaServerCli.java
index e818d04e1..b09f6af21 100644
--- 
a/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/TikaServerCli.java
+++ 
b/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/TikaServerCli.java
@@ -19,6 +19,7 @@ package org.apache.tika.server.core;
 
 import static org.apache.tika.server.core.TikaServerConfig.DEFAULT_HOST;
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ExecutorCompletionService;
@@ -30,8 +31,8 @@ import java.util.concurrent.TimeUnit;
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.CommandLineParser;
 import org.apache.commons.cli.DefaultParser;
-import org.apache.commons.cli.HelpFormatter;
 import org.apache.commons.cli.Options;
+import org.apache.commons.cli.help.HelpFormatter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -180,9 +181,9 @@ public class TikaServerCli {
         TikaServerProcess.main(args.toArray(new String[0]));
     }
 
-    private static void usage(Options options) {
-        HelpFormatter helpFormatter = new HelpFormatter();
-        helpFormatter.printHelp("tikaserver", options);
+    private static void usage(Options options) throws IOException {
+        HelpFormatter helpFormatter = HelpFormatter.builder().get();
+        helpFormatter.printHelp("tikaserver", null, options, null, true);
         System.exit(-1);
     }
 

Reply via email to