From 5265ff6f813c96a162e5671c1030f2d2835789e5 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Sun, 30 Apr 2017 09:12:44 +0000 Subject: [PATCH] Improve information contained in exception in CellRangeAddress() git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1793252 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/ss/util/CellRangeAddress.java | 11 +++++------ 1 file 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("!"); -- 2.39.5