summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2017-04-30 09:12:44 +0000
committerDominik Stadler <centic@apache.org>2017-04-30 09:12:44 +0000
commita8ce5b46e1c65bb9ea5decb2f754a08e9ea58b2e (patch)
treee0dd4ca84c59fa19dc0a47a6b2bd57205e55de92
parent19cf1d5814c7783ff1e423dbc30673249d72d7e2 (diff)
downloadpoi-a8ce5b46e1c65bb9ea5decb2f754a08e9ea58b2e.tar.gz
poi-a8ce5b46e1c65bb9ea5decb2f754a08e9ea58b2e.zip
Improve information contained in exception in CellRangeAddress()
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1793252 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/poi/ss/util/CellRangeAddress.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/java/org/apache/poi/ss/util/CellRangeAddress.java b/src/java/org/apache/poi/ss/util/CellRangeAddress.java
index aee9f82b4c..761120ed4f 100644
--- a/src/java/org/apache/poi/ss/util/CellRangeAddress.java
+++ b/src/java/org/apache/poi/ss/util/CellRangeAddress.java
@@ -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("!");