]> source.dussan.org Git - poi.git/commitdiff
minor perf issue
authorPJ Fanning <fanningpj@apache.org>
Mon, 14 Feb 2022 20:23:56 +0000 (20:23 +0000)
committerPJ Fanning <fanningpj@apache.org>
Mon, 14 Feb 2022 20:23:56 +0000 (20:23 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1898086 13f79535-47bb-0310-9956-ffa450edef68

poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java

index 15859f4fdbcdc48d09e232b45380d63f92b77a29..227260a26e45581d1975b491f4c87f354c6cf6f1 100644 (file)
@@ -626,10 +626,11 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
      * @param n the number of rows to move
      */
     protected void shift(int n) {
-        int rownum = getRowNum() + n;
-        String msg = "Row[rownum=" + getRowNum() + "] contains cell(s) included in a multi-cell array formula. " +
+        final int rownum = getRowNum();
+        final int newRownum = rownum + n;
+        String msg = "Row[rownum=" + rownum + "] contains cell(s) included in a multi-cell array formula. " +
                 "You cannot change part of an array.";
-        setRowNum(rownum);
+        setRowNum(newRownum);
         for(Cell c : this){
             ((XSSFCell)c).updateCellReferencesForShifting(msg);
         }