From 068cd8397064a43f5e8c0e033610cef467044463 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Mon, 14 Feb 2022 20:23:56 +0000 Subject: [PATCH] minor perf issue git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1898086 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/poi/xssf/usermodel/XSSFRow.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java index 15859f4fdb..227260a26e 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java @@ -626,10 +626,11 @@ public class XSSFRow implements Row, Comparable { * @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); }