]> source.dussan.org Git - poi.git/commitdiff
[bug-66079] try to fix issue with XWPFNumbering.removeAbstractNum
authorPJ Fanning <fanningpj@apache.org>
Fri, 20 May 2022 09:47:16 +0000 (09:47 +0000)
committerPJ Fanning <fanningpj@apache.org>
Fri, 20 May 2022 09:47:16 +0000 (09:47 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1901083 13f79535-47bb-0310-9956-ffa450edef68

poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFNumbering.java

index 2ff4f4c5eb7aa3b74396218c77a480fb6d036088..62131cafd556840a9e4448a35689f6e151e767e5 100644 (file)
@@ -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;
             }
         }