Summary: | NPE in XWPFStyle.getUsedStyleList(XWPFStyle style, List<XWPFStyle> usedStyleList) | ||
---|---|---|---|
Product: | POI | Reporter: | Yvan Lussaud <yvan.lussaud> |
Component: | XWPF | Assignee: | POI Developers List <dev> |
Status: | NEEDINFO --- | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Linux |
Description
Yvan Lussaud
2021-01-22 14:17:49 UTC
This is handled in https://github.com/apache/poi/pull/216 as well. The patch looks valid, but can you provide a bit more sample-code to reproduce this so we can add a unit-test which verifies this in the future? I tried with the following, but this works with the latest version of Apache POI: @Test public void test65099() throws IOException { try (XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("65099.docx")) { XWPFStyles styles = doc.getStyles(); assertNotNull(styles); XWPFStyle normal = styles.getStyle("Normal"); assertNotNull(normal); XWPFStyle style1 = styles.getStyle("EdfTitre3Car"); assertNotNull(style1); List<XWPFStyle> list = styles.getUsedStyleList(normal); assertNotNull(list); assertEquals(1, list.size()); list = styles.getUsedStyleList(style1); assertNotNull(list); assertEquals(7, list.size()); } } Yes I forgot the style initialization: XWPFStyle style = document.getStyles().getStyle("TableauGrille41"); inputDoc.getStyles().getUsedStyleList(style); This trigger the NPE with the linked document. |