Author: fanningpj
Date: Sat Nov 20 16:50:15 2021
New Revision: 1895211

URL: http://svn.apache.org/viewvc?rev=1895211&view=rev
Log:
fix broken test

Modified:
    
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java

Modified: 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java?rev=1895211&r1=1895210&r2=1895211&view=diff
==============================================================================
--- 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java 
(original)
+++ 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java 
Sat Nov 20 16:50:15 2021
@@ -3051,18 +3051,20 @@ public class XSSFSheet extends POIXMLDoc
 
         // also remove any comments associated with this row
         if (sheetComments != null) {
+            ArrayList<CellAddress> refsToRemove = new ArrayList<>();
             Iterator<CellAddress> commentAddressIterator = 
sheetComments.getCellAddresses();
             while (commentAddressIterator.hasNext()) {
                 CellAddress ref = commentAddressIterator.next();
-
                 // is this comment part of the current row?
                 if(rowsToRemoveSet.contains(ref.getRow())) {
-                    sheetComments.removeComment(ref);
-                    if (vml != null) {
-                        vml.removeCommentShape(ref.getRow(), ref.getColumn());
-                    }
+                    refsToRemove.add(ref);
+                }
+            }
+            for (CellAddress ref : refsToRemove) {
+                sheetComments.removeComment(ref);
+                if (vml != null) {
+                    vml.removeCommentShape(ref.getRow(), ref.getColumn());
                 }
-
             }
         }
 
@@ -3106,7 +3108,7 @@ public class XSSFSheet extends POIXMLDoc
             XSSFRow row = (XSSFRow)it.next();
             int rownum = row.getRowNum();
 
-            if(sheetComments != null){
+            if(sheetComments != null) {
                 // calculate the new rownum
                 int newrownum = shiftedRowNum(startRow, endRow, n, rownum);
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to