This is an automated email from the ASF dual-hosted git repository.
tallison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tika.git
The following commit(s) were added to refs/heads/master by this push:
new 056304f TIKA-2931 (#281)
056304f is described below
commit 056304fc8eea69cbb32dd3d3898edee6859f800d
Author: Eric Pugh <[email protected]>
AuthorDate: Wed Sep 4 08:10:01 2019 -0400
TIKA-2931 (#281)
* need to lowercase the output file to match the format passed to tesseract
cmd line
* need to lowercase the output file to match the format passed to tesseract
cmd line
* pull original code from apache/tika
* Send informational output to System.err, not System.out so commandline
json response is clean
---
tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java | 2 +-
tika-app/src/test/java/org/apache/tika/cli/TikaCLITest.java | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java
b/tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java
index 60cb05e..bb3f91a 100644
--- a/tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java
+++ b/tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java
@@ -1051,7 +1051,7 @@ public class TikaCLI {
throw new IOException("unable to create directory \"" +
parent + "\"");
}
}
- System.out.println("Extracting '"+name+"' ("+contentType+") to " +
outputFile);
+ System.err.println("Extracting '"+name+"' ("+contentType+") to " +
outputFile);
try (FileOutputStream os = new FileOutputStream(outputFile)) {
if (inputStream instanceof TikaInputStream) {
diff --git a/tika-app/src/test/java/org/apache/tika/cli/TikaCLITest.java
b/tika-app/src/test/java/org/apache/tika/cli/TikaCLITest.java
index bce3d18..ab17b68 100644
--- a/tika-app/src/test/java/org/apache/tika/cli/TikaCLITest.java
+++ b/tika-app/src/test/java/org/apache/tika/cli/TikaCLITest.java
@@ -49,7 +49,9 @@ public class TikaCLITest {
/* Test members */
private ByteArrayOutputStream outContent = null;
+ private ByteArrayOutputStream errContent = null;
private PrintStream stdout = null;
+ private PrintStream stderr = null;
private File testDataFile = new File("src/test/resources/test-data");
private URI testDataURI = testDataFile.toURI();
private String resourcePrefix;
@@ -57,9 +59,12 @@ public class TikaCLITest {
@Before
public void setUp() throws Exception {
outContent = new ByteArrayOutputStream();
+ errContent = new ByteArrayOutputStream();
resourcePrefix = testDataURI.toString();
stdout = System.out;
+ stderr = System.err;
System.setOut(new PrintStream(outContent, true, UTF_8.name()));
+ System.setErr(new PrintStream(errContent, true, UTF_8.name()));
}
/**
@@ -258,11 +263,12 @@ public class TikaCLITest {
}
/**
- * Tears down the test. Returns the System.out
+ * Tears down the test. Returns the System.out and System.err
*/
@After
public void tearDown() throws Exception {
System.setOut(stdout);
+ System.setErr(stderr);
}
@Test
@@ -402,7 +408,7 @@ public class TikaCLITest {
new File("subdir/foo.txt").delete();
new File("subdir").delete();
TikaCLI.main(params);
- String content = outContent.toString(UTF_8.name());
+ String content = errContent.toString(UTF_8.name());
assertTrue(content.contains("Extracting 'subdir/foo.txt'"));
// clean up. TODO: These should be in target.
new File("target/subdir/foo.txt").delete();