From a0ce6b67286a06d3244995f5af655d91136f0550 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Fri, 20 May 2022 09:47:16 +0000 Subject: [PATCH] [bug-66079] try to fix issue with XWPFNumbering.removeAbstractNum git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1901083 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/xwpf/usermodel/XWPFNumbering.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFNumbering.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFNumbering.java index 2ff4f4c5eb..62131cafd5 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFNumbering.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFNumbering.java @@ -240,8 +240,16 @@ public class XWPFNumbering extends POIXMLDocumentPart { for (XWPFAbstractNum abstractNum : abstractNums) { BigInteger foundNumId = abstractNum.getAbstractNum().getAbstractNumId(); if(abstractNumID.equals(foundNumId)) { - ctNumbering.removeAbstractNum(foundNumId.byteValue()); abstractNums.remove(abstractNum); + break; + } + } + + for (int i = 0; i < ctNumbering.sizeOfAbstractNumArray(); i++) { + CTAbstractNum ctAbstractNum = ctNumbering.getAbstractNumArray(i); + BigInteger foundNumId = ctAbstractNum.getAbstractNumId(); + if(abstractNumID.equals(foundNumId)) { + ctNumbering.removeAbstractNum(i); return true; } }