You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2017/04/26 14:47:17 UTC
[tika] branch master updated: TIKA-2039 -- extra unit test...
ensure standard handling of exception in embedded file
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 11ad0fd TIKA-2039 -- extra unit test... ensure standard handling of exception in embedded file
11ad0fd is described below
commit 11ad0fd294fd4b673ecbed451c2057eae42a9f27
Author: tballison <ta...@mitre.org>
AuthorDate: Wed Apr 26 10:47:09 2017 -0400
TIKA-2039 -- extra unit test... ensure standard handling of
exception in embedded file
---
.../org/apache/tika/parser/crypto/TSDParserTest.java | 12 ++++++++++++
.../resources/test-documents/testTSD_broken_pdf.tsd | Bin 0 -> 91985 bytes
2 files changed, 12 insertions(+)
diff --git a/tika-parsers/src/test/java/org/apache/tika/parser/crypto/TSDParserTest.java b/tika-parsers/src/test/java/org/apache/tika/parser/crypto/TSDParserTest.java
index 2a73020..97a4130 100644
--- a/tika-parsers/src/test/java/org/apache/tika/parser/crypto/TSDParserTest.java
+++ b/tika-parsers/src/test/java/org/apache/tika/parser/crypto/TSDParserTest.java
@@ -10,6 +10,7 @@ import java.util.List;
import org.apache.tika.TikaTest;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.parser.ParseContext;
+import org.apache.tika.parser.RecursiveParserWrapper;
import org.apache.tika.sax.BodyContentHandler;
import org.junit.Test;
import org.xml.sax.ContentHandler;
@@ -148,4 +149,15 @@ public class TSDParserTest extends TikaTest {
assertContains(TSDParser.class.getName(),
Arrays.asList(list.get(0).getValues("X-Parsed-By")));
}
+
+ @Test
+ public void testBrokenPdf() throws Exception {
+ //make sure that embedded file appears in list
+ //and make sure embedded exception is recorded
+ List<Metadata> list = getRecursiveMetadata("testTSD_broken_pdf.tsd");
+ assertEquals(2, list.size());
+ assertEquals("application/pdf", list.get(1).get(Metadata.CONTENT_TYPE));
+ assertNotNull(list.get(1).get(RecursiveParserWrapper.EMBEDDED_EXCEPTION));
+ assertContains("org.apache.pdfbox.pdmodel.PDDocument.load", list.get(1).get(RecursiveParserWrapper.EMBEDDED_EXCEPTION));
+ }
}
diff --git a/tika-parsers/src/test/resources/test-documents/testTSD_broken_pdf.tsd b/tika-parsers/src/test/resources/test-documents/testTSD_broken_pdf.tsd
new file mode 100644
index 0000000..9fe32a1
Binary files /dev/null and b/tika-parsers/src/test/resources/test-documents/testTSD_broken_pdf.tsd differ
--
To stop receiving notification emails like this one, please contact
['"commits@tika.apache.org" <co...@tika.apache.org>'].