]> source.dussan.org Git - poi.git/commitdiff
Bug 55280: Don't repeatedely fetch the size of the CTMergeCells object as this is...
authorDominik Stadler <centic@apache.org>
Sun, 31 Aug 2014 19:53:53 +0000 (19:53 +0000)
committerDominik Stadler <centic@apache.org>
Sun, 31 Aug 2014 19:53:53 +0000 (19:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1621631 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java

index 29c391ee6d92352dc31606b08bac00e64fe079ea..543263f7af647423b477d252fcf7ae1461383421 100644 (file)
@@ -1579,8 +1579,9 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
     public void removeMergedRegion(int index) {
         CTMergeCells ctMergeCells = worksheet.getMergeCells();
 
-        CTMergeCell[] mergeCellsArray = new CTMergeCell[ctMergeCells.sizeOfMergeCellArray() - 1];
-        for (int i = 0 ; i < ctMergeCells.sizeOfMergeCellArray() ; i++) {
+        int size = ctMergeCells.sizeOfMergeCellArray();
+        CTMergeCell[] mergeCellsArray = new CTMergeCell[size - 1];
+        for (int i = 0 ; i < size ; i++) {
             if (i < index) {
                 mergeCellsArray[i] = ctMergeCells.getMergeCellArray(i);
             }