aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java
diff options
context:
space:
mode:
authorTim Allison <tallison@apache.org>2018-10-26 19:06:18 +0000
committerTim Allison <tallison@apache.org>2018-10-26 19:06:18 +0000
commitaf9142e4b744638fa448f81081a7cda1bc376576 (patch)
tree7d4f3b0b7cfe9ad62a28fd51f544bb05364ab965 /src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java
parent960cbb77146c550661c7f75ef86a151c0f4528d5 (diff)
downloadpoi-af9142e4b744638fa448f81081a7cda1bc376576.tar.gz
poi-af9142e4b744638fa448f81081a7cda1bc376576.zip
bug 62859 -- fix two potential NPEs when initializing XWPFSDTContent
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1844920 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java')
-rw-r--r--src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java
index deac5c09ae..9388e08710 100644
--- a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java
+++ b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java
@@ -148,6 +148,19 @@ public final class TestXWPFSDT {
assertEquals("", sdts.get(0).getTitle());
}
+ @Test
+ public void test62859() throws IOException {
+ //this doesn't test the exact code path for this issue, but
+ //it does test for a related issue, and the fix fixes both.
+ //We should try to add the actual triggering document
+ //to our test suite.
+ XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Bug62859.docx");
+ List<XWPFAbstractSDT> sdts = extractAllSDTs(doc);
+ assertEquals(1, sdts.size());
+ assertEquals("", sdts.get(0).getTag());
+ assertEquals("", sdts.get(0).getTitle());
+ }
+
private List<XWPFAbstractSDT> extractAllSDTs(XWPFDocument doc) {
List<XWPFAbstractSDT> sdts = new ArrayList<>();