Skip to content

Commit 1d40f78

Browse files
committed
TIKA-4455: replace deprecated
1 parent 728a30f commit 1d40f78

5 files changed

Lines changed: 25 additions & 25 deletions

File tree

tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractComparer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
import java.util.Set;
2727
import java.util.concurrent.ArrayBlockingQueue;
2828

29-
import org.apache.commons.cli.HelpFormatter;
3029
import org.apache.commons.cli.Option;
3130
import org.apache.commons.cli.Options;
31+
import org.apache.commons.cli.help.HelpFormatter;
3232
import org.apache.commons.io.FilenameUtils;
3333

3434
import org.apache.tika.batch.FileResource;
@@ -126,10 +126,10 @@ public ExtractComparer(ArrayBlockingQueue<FileResource> queue, Path inputDir, Pa
126126
this.extractReader = extractReader;
127127
}
128128

129-
public static void USAGE() {
130-
HelpFormatter helpFormatter = new HelpFormatter();
131-
helpFormatter.printHelp(80, "java -jar tika-eval-x.y.jar Compare -extractsA extractsA -extractsB extractsB -db mydb", "Tool: Compare", ExtractComparer.OPTIONS,
132-
"Note: for the default h2 db, do not include the .mv.db at the end of the db name.");
129+
public static void USAGE() throws IOException {
130+
HelpFormatter helpFormatter = HelpFormatter.builder().get();
131+
helpFormatter.printHelp("java -jar tika-eval-x.y.jar Compare -extractsA extractsA -extractsB extractsB -db mydb", "Tool: Compare", ExtractComparer.OPTIONS,
132+
"Note: for the default h2 db, do not include the .mv.db at the end of the db name.", true);
133133
}
134134

135135
@Override

tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractProfiler.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
import java.util.Map;
2525
import java.util.concurrent.ArrayBlockingQueue;
2626

27-
import org.apache.commons.cli.HelpFormatter;
2827
import org.apache.commons.cli.Option;
2928
import org.apache.commons.cli.Options;
29+
import org.apache.commons.cli.help.HelpFormatter;
3030

3131
import org.apache.tika.batch.FileResource;
3232
import org.apache.tika.eval.app.db.ColInfo;
@@ -119,10 +119,10 @@ public ExtractProfiler(ArrayBlockingQueue<FileResource> queue, Path inputDir, Pa
119119
this.extractReader = extractReader;
120120
}
121121

122-
public static void USAGE() {
123-
HelpFormatter helpFormatter = new HelpFormatter();
124-
helpFormatter.printHelp(80, "java -jar tika-eval-x.y.jar Profile -extracts extracts -db mydb [-inputDir input]", "Tool: Profile", ExtractProfiler.OPTIONS,
125-
"Note: for the default h2 db, do not include the .mv.db at the end of the db name.");
122+
public static void USAGE() throws IOException {
123+
HelpFormatter helpFormatter = HelpFormatter.builder().get();
124+
helpFormatter.printHelp("java -jar tika-eval-x.y.jar Profile -extracts extracts -db mydb [-inputDir input]", "Tool: Profile", ExtractProfiler.OPTIONS,
125+
"Note: for the default h2 db, do not include the .mv.db at the end of the db name.", true);
126126
}
127127

128128
@Override

tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/FileProfiler.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
import java.util.Map;
2626
import java.util.concurrent.ArrayBlockingQueue;
2727

28-
import org.apache.commons.cli.HelpFormatter;
2928
import org.apache.commons.cli.Option;
3029
import org.apache.commons.cli.Options;
30+
import org.apache.commons.cli.help.HelpFormatter;
3131
import org.apache.commons.codec.digest.DigestUtils;
3232
import org.apache.commons.io.FilenameUtils;
3333
import org.slf4j.Logger;
@@ -101,10 +101,10 @@ public FileProfiler(ArrayBlockingQueue<FileResource> fileQueue, Path inputDir, I
101101
this.inputDir = inputDir;
102102
}
103103

104-
public static void USAGE() {
105-
HelpFormatter helpFormatter = new HelpFormatter();
106-
helpFormatter.printHelp(80, "java -jar tika-eval-x.y.jar FileProfiler -inputDir docs -db mydb [-inputDir input]", "Tool: Profile", FileProfiler.OPTIONS,
107-
"Note: for the default h2 db, do not include the .mv.db at the end of the db name.");
104+
public static void USAGE() throws IOException {
105+
HelpFormatter helpFormatter = HelpFormatter.builder().get();
106+
helpFormatter.printHelp("java -jar tika-eval-x.y.jar FileProfiler -inputDir docs -db mydb [-inputDir input]", "Tool: Profile", FileProfiler.OPTIONS,
107+
"Note: for the default h2 db, do not include the .mv.db at the end of the db name.", true);
108108
}
109109

110110
@Override

tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/reports/ResultsReporter.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636

3737
import org.apache.commons.cli.CommandLine;
3838
import org.apache.commons.cli.DefaultParser;
39-
import org.apache.commons.cli.HelpFormatter;
4039
import org.apache.commons.cli.Options;
4140
import org.apache.commons.cli.ParseException;
41+
import org.apache.commons.cli.help.HelpFormatter;
4242
import org.apache.poi.common.usermodel.HyperlinkType;
4343
import org.slf4j.Logger;
4444
import org.slf4j.LoggerFactory;
@@ -76,11 +76,10 @@ public class ResultsReporter {
7676
List<String> after = new ArrayList<>();
7777
List<Report> reports = new ArrayList<>();
7878

79-
public static void USAGE() {
80-
HelpFormatter helpFormatter = new HelpFormatter();
81-
helpFormatter.printHelp(80, "java -jar tika-eval-x.y.jar Report -db mydb [-rd myreports] [-rf myreports.xml]", "Tool: Report", ResultsReporter.OPTIONS,
82-
"Note: for h2 db, do not include the .mv.db at the end of the db name.");
83-
79+
public static void USAGE() throws IOException {
80+
HelpFormatter helpFormatter = HelpFormatter.builder().get();
81+
helpFormatter.printHelp("java -jar tika-eval-x.y.jar Report -db mydb [-rd myreports] [-rf myreports.xml]", "Tool: Report", ResultsReporter.OPTIONS,
82+
"Note: for h2 db, do not include the .mv.db at the end of the db name.", true);
8483
}
8584

8685
public static ResultsReporter build(Path p) throws Exception {

tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/TikaServerCli.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import static org.apache.tika.server.core.TikaServerConfig.DEFAULT_HOST;
2121

22+
import java.io.IOException;
2223
import java.util.ArrayList;
2324
import java.util.List;
2425
import java.util.concurrent.ExecutorCompletionService;
@@ -30,8 +31,8 @@
3031
import org.apache.commons.cli.CommandLine;
3132
import org.apache.commons.cli.CommandLineParser;
3233
import org.apache.commons.cli.DefaultParser;
33-
import org.apache.commons.cli.HelpFormatter;
3434
import org.apache.commons.cli.Options;
35+
import org.apache.commons.cli.help.HelpFormatter;
3536
import org.slf4j.Logger;
3637
import org.slf4j.LoggerFactory;
3738

@@ -180,9 +181,9 @@ public static void noFork(TikaServerConfig tikaServerConfig) throws Exception {
180181
TikaServerProcess.main(args.toArray(new String[0]));
181182
}
182183

183-
private static void usage(Options options) {
184-
HelpFormatter helpFormatter = new HelpFormatter();
185-
helpFormatter.printHelp("tikaserver", options);
184+
private static void usage(Options options) throws IOException {
185+
HelpFormatter helpFormatter = HelpFormatter.builder().get();
186+
helpFormatter.printHelp("tikaserver", null, options, null, true);
186187
System.exit(-1);
187188
}
188189

0 commit comments

Comments
 (0)