Author: centic
Date: Sun Apr 30 09:12:44 2017
New Revision: 1793252

URL: http://svn.apache.org/viewvc?rev=1793252&view=rev
Log:
Improve information contained in exception in CellRangeAddress()

Modified:
    poi/trunk/src/java/org/apache/poi/ss/util/CellRangeAddress.java

Modified: poi/trunk/src/java/org/apache/poi/ss/util/CellRangeAddress.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/CellRangeAddress.java?rev=1793252&r1=1793251&r2=1793252&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/CellRangeAddress.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/CellRangeAddress.java Sun Apr 30 
09:12:44 2017
@@ -32,9 +32,6 @@ import org.apache.poi.util.LittleEndianO
  * @author Dragos Buleandra ([email protected])
  */
 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 Ce
        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 Ce
      * @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("!");



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to