You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2018/01/31 05:31:32 UTC
svn commit: r1822743 - in /poi/trunk/src:
java/org/apache/poi/hssf/usermodel/HSSFRow.java
ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java
Author: fanningpj
Date: Wed Jan 31 05:31:31 2018
New Revision: 1822743
URL: http://svn.apache.org/viewvc?rev=1822743&view=rev
Log:
fix use of forbidden apis in row shift code
Modified:
poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java
Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java?rev=1822743&r1=1822742&r2=1822743&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java Wed Jan 31 05:31:31 2018
@@ -24,13 +24,12 @@ import org.apache.poi.hssf.record.CellVa
import org.apache.poi.hssf.record.ExtendedFormatRecord;
import org.apache.poi.hssf.record.RowRecord;
import org.apache.poi.ss.SpreadsheetVersion;
-import org.apache.poi.ss.formula.eval.NotImplementedException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.util.Configurator;
-import org.apache.poi.util.NotImplemented;
+import org.apache.poi.util.LocaleUtil;
/**
* High level representation of a row of a spreadsheet.
@@ -720,16 +719,17 @@ public final class HSSFRow implements Ro
/**
* Shifts column range [firstShiftColumnIndex-lastShiftColumnIndex] step places to the right.
- * @param startColumn the column to start shifting
- * @param endColumn the column to end shifting
+ * @param firstShiftColumnIndex the column to start shifting
+ * @param lastShiftColumnIndex the column to end shifting
* @param step length of the shifting step
*/
@Override
- public void shiftCellsRight(int firstShiftColumnIndex, int lastShiftColumnIndex, int step){
+ public void shiftCellsRight(int firstShiftColumnIndex, int lastShiftColumnIndex, int step) {
if(step < 0)
throw new IllegalArgumentException("Shifting step may not be negative ");
if(firstShiftColumnIndex > lastShiftColumnIndex)
- throw new IllegalArgumentException(String.format("Incorrect shifting range : %d-%d", firstShiftColumnIndex, lastShiftColumnIndex));
+ throw new IllegalArgumentException(String.format(LocaleUtil.getUserLocale(),
+ "Incorrect shifting range : %d-%d", firstShiftColumnIndex, lastShiftColumnIndex));
if(lastShiftColumnIndex + step + 1> cells.length)
extend(lastShiftColumnIndex + step + 1);
for (int columnIndex = lastShiftColumnIndex; columnIndex >= firstShiftColumnIndex; columnIndex--){ // process cells backwards, because of shifting
@@ -748,16 +748,17 @@ public final class HSSFRow implements Ro
}
/**
* Shifts column range [firstShiftColumnIndex-lastShiftColumnIndex] step places to the left.
- * @param startColumn the column to start shifting
- * @param endColumn the column to end shifting
+ * @param firstShiftColumnIndex the column to start shifting
+ * @param lastShiftColumnIndex the column to end shifting
* @param step length of the shifting step
*/
@Override
- public void shiftCellsLeft(int firstShiftColumnIndex, int lastShiftColumnIndex, int step){
+ public void shiftCellsLeft(int firstShiftColumnIndex, int lastShiftColumnIndex, int step) {
if(step < 0)
throw new IllegalArgumentException("Shifting step may not be negative ");
if(firstShiftColumnIndex > lastShiftColumnIndex)
- throw new IllegalArgumentException(String.format("Incorrect shifting range : %d-%d", firstShiftColumnIndex, lastShiftColumnIndex));
+ throw new IllegalArgumentException(String.format(LocaleUtil.getUserLocale(),
+ "Incorrect shifting range : %d-%d", firstShiftColumnIndex, lastShiftColumnIndex));
if(firstShiftColumnIndex - step < 0)
throw new IllegalStateException("Column index less than zero : " + (Integer.valueOf(firstShiftColumnIndex + step)).toString());
for (int columnIndex = firstShiftColumnIndex; columnIndex <= lastShiftColumnIndex; columnIndex++){
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java?rev=1822743&r1=1822742&r2=1822743&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java Wed Jan 31 05:31:31 2018
@@ -32,6 +32,7 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.util.Beta;
import org.apache.poi.util.Internal;
+import org.apache.poi.util.LocaleUtil;
import org.apache.poi.xssf.model.StylesTable;
import org.apache.poi.xssf.usermodel.helpers.XSSFRowShifter;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCell;
@@ -551,7 +552,7 @@ public class XSSFRow implements Row, Com
*/
protected void shift(int n) {
int rownum = getRowNum() + n;
- String msg = "Row[rownum="+getRowNum()+"] contains cell(s) included in a multi-cell array formula. " +
+ String msg = "Row[rownum=" + getRowNum() + "] contains cell(s) included in a multi-cell array formula. " +
"You cannot change part of an array.";
for(Cell c : this){
((XSSFCell)c).updateCellReferencesForShifting(msg);
@@ -641,16 +642,17 @@ public class XSSFRow implements Row, Com
/**
* Shifts column range [firstShiftColumnIndex-lastShiftColumnIndex] step places to the right.
- * @param startColumn the column to start shifting
- * @param endColumn the column to end shifting
+ * @param firstShiftColumnIndex the column to start shifting
+ * @param lastShiftColumnIndex the column to end shifting
* @param step length of the shifting step
*/
@Override
- public void shiftCellsRight(int firstShiftColumnIndex, int lastShiftColumnIndex, int step){
+ public void shiftCellsRight(int firstShiftColumnIndex, int lastShiftColumnIndex, int step) {
if(step < 0)
throw new IllegalArgumentException("Shifting step may not be negative ");
if(firstShiftColumnIndex > lastShiftColumnIndex)
- throw new IllegalArgumentException(String.format("Incorrect shifting range : %d-%d", firstShiftColumnIndex, lastShiftColumnIndex));
+ throw new IllegalArgumentException(String.format(LocaleUtil.getUserLocale(),
+ "Incorrect shifting range : %d-%d", firstShiftColumnIndex, lastShiftColumnIndex));
for (int columnIndex = lastShiftColumnIndex; columnIndex >= firstShiftColumnIndex; columnIndex--){ // process cells backwards, because of shifting
shiftCell(columnIndex, step);
}
@@ -664,16 +666,17 @@ public class XSSFRow implements Row, Com
}
/**
* Shifts column range [firstShiftColumnIndex-lastShiftColumnIndex] step places to the left.
- * @param startColumn the column to start shifting
- * @param endColumn the column to end shifting
+ * @param firstShiftColumnIndex the column to start shifting
+ * @param lastShiftColumnIndex the column to end shifting
* @param step length of the shifting step
*/
@Override
- public void shiftCellsLeft(int firstShiftColumnIndex, int lastShiftColumnIndex, int step){
+ public void shiftCellsLeft(int firstShiftColumnIndex, int lastShiftColumnIndex, int step) {
if(step < 0)
throw new IllegalArgumentException("Shifting step may not be negative ");
if(firstShiftColumnIndex > lastShiftColumnIndex)
- throw new IllegalArgumentException(String.format("Incorrect shifting range : %d-%d", firstShiftColumnIndex, lastShiftColumnIndex));
+ throw new IllegalArgumentException(String.format(LocaleUtil.getUserLocale(),
+ "Incorrect shifting range : %d-%d", firstShiftColumnIndex, lastShiftColumnIndex));
if(firstShiftColumnIndex - step < 0)
throw new IllegalStateException("Column index less than zero : " + (Integer.valueOf(firstShiftColumnIndex + step)).toString());
for (int columnIndex = firstShiftColumnIndex; columnIndex <= lastShiftColumnIndex; columnIndex++){
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org