Improve information contained in exception in CellRangeAddress()

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1793252 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2017-04-30 09:12:44 +00:00
parent 19cf1d5814
commit a8ce5b46e1
1 changed files with 5 additions and 6 deletions

View File

@ -32,9 +32,6 @@ import org.apache.poi.util.LittleEndianOutput;
* @author Dragos Buleandra (dragos.buleandra@trade2b.ro)
*/
public class CellRangeAddress extends CellRangeAddressBase {
/*
* TODO - replace org.apache.poi.hssf.util.Region
*/
public static final int ENCODED_SIZE = 8;
/**
@ -48,8 +45,10 @@ public class CellRangeAddress extends CellRangeAddressBase {
public CellRangeAddress(int firstRow, int lastRow, int firstCol, int lastCol) {
super(firstRow, lastRow, firstCol, lastCol);
if (lastRow < firstRow || lastCol < firstCol)
throw new IllegalArgumentException("lastRow < firstRow || lastCol < firstCol");
if (lastRow < firstRow || lastCol < firstCol) {
throw new IllegalArgumentException("Invalid cell range, having lastRow < firstRow || lastCol < firstCol, " +
"had rows " + lastRow + " >= " + firstRow + " or cells " + lastCol + " >= " + firstCol);
}
}
public void serialize(LittleEndianOutput out) {
@ -91,7 +90,7 @@ public class CellRangeAddress extends CellRangeAddressBase {
* @return the text format of this range using specified sheet name.
*/
public String formatAsString(String sheetName, boolean useAbsoluteAddress) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
if (sheetName != null) {
sb.append(SheetNameFormatter.format(sheetName));
sb.append("!");