aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/testcases
diff options
context:
space:
mode:
authorYegor Kozlov <yegor@apache.org>2011-09-12 10:19:50 +0000
committerYegor Kozlov <yegor@apache.org>2011-09-12 10:19:50 +0000
commit3ca4e3bd2dd36ab16c38b2609d5ff9c666b52384 (patch)
tree2ec2418a6cad6b992616095691c054d50e2e6c20 /src/ooxml/testcases
parent686f2ca6d060cd8e11f55f816e7f77df3eaf3d3c (diff)
downloadpoi-3ca4e3bd2dd36ab16c38b2609d5ff9c666b52384.tar.gz
poi-3ca4e3bd2dd36ab16c38b2609d5ff9c666b52384.zip
avoid exceptions when using POI in Tika, see BUgs 51771 and 51770
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1169679 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/testcases')
-rw-r--r--src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFPictureData.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFPictureData.java b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFPictureData.java
index 72aa4c115e..89dfcb1453 100644
--- a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFPictureData.java
+++ b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFPictureData.java
@@ -129,4 +129,26 @@ public class TestXWPFPictureData extends TestCase {
public void testGetChecksum() {
}
+
+ public void testBug51770() throws InvalidFormatException, IOException {
+ XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Bug51170.docx");
+ XWPFHeaderFooterPolicy policy = doc.getHeaderFooterPolicy();
+ XWPFHeader header = policy.getDefaultHeader();
+ for (XWPFParagraph paragraph : header.getParagraphs()) {
+ for (XWPFRun run : paragraph.getRuns()) {
+ for (XWPFPicture picture : run.getEmbeddedPictures()) {
+ if (paragraph.getDocument() != null) {
+ System.out.println(picture.getCTPicture());
+ XWPFPictureData data = picture.getPictureData();
+ if(data != null) System.out.println(data.getFileName());
+ }
+ }
+ }
+ }
+
+ }
+
+ private void process(XWPFParagraph paragraph){
+
+ }
}