diff --git a/poi-integration/src/test/java/org/apache/poi/stress/POIXMLDocumentHandler.java b/poi-integration/src/test/java/org/apache/poi/stress/POIXMLDocumentHandler.java index 930c904a77..c99ebcb201 100644 --- a/poi-integration/src/test/java/org/apache/poi/stress/POIXMLDocumentHandler.java +++ b/poi-integration/src/test/java/org/apache/poi/stress/POIXMLDocumentHandler.java @@ -59,14 +59,26 @@ public final class POIXMLDocumentHandler { protected static void cursorRecursive(XmlObject base) { XmlCursor cur = base.newCursor(); try { - if (!cur.toFirstChild()) { - return; - } - do { - cursorRecursive(cur.getObject()); - } while (cur.toNextSibling()); + cursorRecursive(cur); } finally { cur.dispose(); } } + + private static void cursorRecursive(XmlCursor cur) { + do { + assertNotNull(cur.getObject()); + cur.push(); + for (boolean b = cur.toFirstAttribute(); b; b = cur.toNextAttribute()) { + assertNotNull(cur.getObject()); + } + cur.pop(); + cur.push(); + + if (cur.toFirstChild()) { + cursorRecursive(cur); + } + cur.pop(); + } while (cur.toNextSibling()); + } } diff --git a/test-data/integration/testPDFEmbeddingAndEmbedded.docx b/test-data/integration/testPDFEmbeddingAndEmbedded.docx new file mode 100644 index 0000000000..e16bf3c610 Binary files /dev/null and b/test-data/integration/testPDFEmbeddingAndEmbedded.docx differ diff --git a/test-data/integration/test_recursive_embedded.docx b/test-data/integration/test_recursive_embedded.docx new file mode 100644 index 0000000000..cd562cbb82 Binary files /dev/null and b/test-data/integration/test_recursive_embedded.docx differ