diff --git a/assembly.xml b/assembly.xml index 3cbf862459..4095cac561 100644 --- a/assembly.xml +++ b/assembly.xml @@ -26,7 +26,8 @@ **/target/** **/.*/** - **/opennlp/*.bin + **/opennlp/ner-*.bin + **/opennlp/en-*.bin **/recognition/*.bin **/*.releaseBackup diff --git a/tika-app/src/test/java/org/apache/tika/cli/TikaCLIBatchCommandLineTest.java b/tika-app/src/test/java/org/apache/tika/cli/TikaCLIBatchCommandLineTest.java index 2eb26773e9..a5f95ea092 100644 --- a/tika-app/src/test/java/org/apache/tika/cli/TikaCLIBatchCommandLineTest.java +++ b/tika-app/src/test/java/org/apache/tika/cli/TikaCLIBatchCommandLineTest.java @@ -31,6 +31,7 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; +import org.apache.tika.utils.ProcessUtils; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -176,9 +177,7 @@ public void testOneDirOneFileException() throws Exception { boolean ex = false; try { String path = testFile.toAbsolutePath().toString(); - if (path.contains(" ")) { - path = "\"" + path + "\""; - } + path = ProcessUtils.escapeCommandLine(path); String[] params = {testInputPathForCommandLine, path}; String[] commandLine = BatchCommandLineBuilder.build(params); diff --git a/tika-batch/src/test/java/org/apache/tika/batch/fs/FSBatchTestBase.java b/tika-batch/src/test/java/org/apache/tika/batch/fs/FSBatchTestBase.java index 3ce7198986..ec0c3d971e 100644 --- a/tika-batch/src/test/java/org/apache/tika/batch/fs/FSBatchTestBase.java +++ b/tika-batch/src/test/java/org/apache/tika/batch/fs/FSBatchTestBase.java @@ -170,6 +170,7 @@ public ProcessBuilder getNewBatchRunnerProcess(String testConfig, String loggerP private String[] commandLine(String testConfig, String loggerProps, String[] args) { List commandLine = new ArrayList<>(); commandLine.add("java"); + commandLine.add("-Djava.awt.headless=true"); commandLine.add("-Dlog4j.configuration=file:"+ this.getClass().getResource(loggerProps).getFile()); commandLine.add("-Xmx128m"); @@ -200,6 +201,7 @@ public BatchProcessDriverCLI getNewDriver(String testConfig, String[] args) throws Exception { List commandLine = new ArrayList<>(); commandLine.add("java"); + commandLine.add("-Djava.awt.headless=true"); commandLine.add("-Xmx128m"); commandLine.add("-cp"); String cp = System.getProperty("java.class.path"); diff --git a/tika-eval/src/test/java/org/apache/tika/eval/TikaEvalCLITest.java b/tika-eval/src/test/java/org/apache/tika/eval/TikaEvalCLITest.java index ea06f70ca0..531471259c 100644 --- a/tika-eval/src/test/java/org/apache/tika/eval/TikaEvalCLITest.java +++ b/tika-eval/src/test/java/org/apache/tika/eval/TikaEvalCLITest.java @@ -35,6 +35,7 @@ import org.apache.commons.io.FileUtils; import org.apache.tika.TikaTest; +import org.apache.tika.utils.ProcessUtils; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Ignore; @@ -123,9 +124,14 @@ private static void compare() throws IOException { List args = new ArrayList<>(); args.add("Compare"); args.add("-extractsA"); - args.add(extractsDir.resolve("extractsA").toAbsolutePath().toString()); + args.add( + ProcessUtils.escapeCommandLine( + extractsDir.resolve("extractsA") + .toAbsolutePath().toString())); args.add("-extractsB"); - args.add(extractsDir.resolve("extractsB").toAbsolutePath().toString()); + args.add(ProcessUtils.escapeCommandLine( + extractsDir.resolve("extractsB") + .toAbsolutePath().toString())); //add these just to confirm this info doesn't cause problems w cli args.add("-maxTokens"); args.add("10000000"); @@ -135,7 +141,10 @@ private static void compare() throws IOException { args.add("100000"); args.add("-db"); - args.add(compareDBDir.toAbsolutePath().toString()+"/"+dbName); + args.add( + ProcessUtils.escapeCommandLine( + compareDBDir + .toAbsolutePath().toString()+"/"+dbName)); execute(args, 60000); @@ -145,7 +154,9 @@ private static void profile() throws IOException { List args = new ArrayList<>(); args.add("Profile"); args.add("-extracts"); - args.add(extractsDir.resolve("extractsA").toAbsolutePath().toString()); + args.add(ProcessUtils.escapeCommandLine( + extractsDir.resolve("extractsA") + .toAbsolutePath().toString())); //add these just to confirm this info doesn't cause problems w cli args.add("-maxTokens"); args.add("10000000"); @@ -155,7 +166,10 @@ private static void profile() throws IOException { args.add("100000"); args.add("-db"); - args.add(profileDBDir.toAbsolutePath().toString()+"/"+dbName); + args.add( + ProcessUtils.escapeCommandLine( + profileDBDir + .toAbsolutePath().toString()+"/"+dbName)); execute(args, 60000); } @@ -163,9 +177,14 @@ private static void reportProfile() throws IOException { List args = new ArrayList<>(); args.add("Report"); args.add("-db"); - args.add(profileDBDir.toAbsolutePath().toString()+"/"+dbName); + args.add( + ProcessUtils.escapeCommandLine( + profileDBDir.toAbsolutePath() + .toString()+"/"+dbName)); args.add("-rd"); - args.add(profileReportsDir.toAbsolutePath().toString()); + args.add( + ProcessUtils.escapeCommandLine( + profileReportsDir.toAbsolutePath().toString())); execute(args, 60000); } @@ -173,9 +192,13 @@ private static void reportCompare() throws IOException { List args = new ArrayList<>(); args.add("Report"); args.add("-db"); - args.add(compareDBDir.toAbsolutePath().toString()+"/"+dbName); + args.add( + ProcessUtils.escapeCommandLine( + compareDBDir.toAbsolutePath().toString()+"/"+dbName)); args.add("-rd"); - args.add(compareReportsDir.toAbsolutePath().toString()); + args.add( + ProcessUtils.escapeCommandLine( + compareReportsDir.toAbsolutePath().toString())); execute(args, 60000); } @@ -186,11 +209,20 @@ public void testOneOff() throws Exception { List args = new ArrayList<>(); args.add("Compare"); args.add("-extractsA"); - args.add(extractsDir.resolve("extractsA").toAbsolutePath().toString()); + args.add( + ProcessUtils.escapeCommandLine( + extractsDir.resolve("extractsA") + .toAbsolutePath().toString())); args.add("-extractsB"); - args.add(extractsDir.resolve("extractsB").toAbsolutePath().toString()); + args.add( + ProcessUtils.escapeCommandLine( + extractsDir.resolve("extractsB") + .toAbsolutePath().toString())); args.add("-db"); - args.add(compareDBDir.toAbsolutePath().toString()+"/"+dbName); + args.add( + ProcessUtils.escapeCommandLine( + compareDBDir.toAbsolutePath() + .toString()+"/"+dbName)); execute(args, 60000); // args.add("-drop"); @@ -202,6 +234,7 @@ private static void execute(List incomingArgs, long maxMillis) throws IO List args = new ArrayList<>(); String cp = System.getProperty("java.class.path"); args.add("java"); + args.add("-Djava.awt.headless=true"); args.add("-cp"); args.add(cp); args.add("org.apache.tika.eval.TikaEvalCLI");