acoliver 2002/08/01 11:18:16
Modified: src/java/org/apache/poi/hssf/usermodel HSSFCell.java
Log:
get mad and throw a runtime error if users specify columns > 255
(more than Excel will allow)
Revision Changes Path
1.16 +12 -0 jakarta-poi/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
Index: HSSFCell.java
===================================================================
RCS file:
/home/cvs/jakarta-poi/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- HSSFCell.java 15 Jul 2002 00:14:40 -0000 1.15
+++ HSSFCell.java 1 Aug 2002 18:18:16 -0000 1.16
@@ -182,6 +182,7 @@
//protected HSSFCell(Workbook book, Sheet sheet, short row, short col)
protected HSSFCell(Workbook book, Sheet sheet, int row, short col)
{
+ checkBounds(col);
cellNum = col;
this.row = row;
cellStyle = null;
@@ -221,6 +222,7 @@
protected HSSFCell(Workbook book, Sheet sheet, int row, short col,
int type)
{
+ checkBounds(col);
cellNum = col;
this.row = row;
cellType = type;
@@ -952,5 +954,15 @@
protected CellValueRecordInterface getCellValueRecord()
{
return record;
+ }
+
+ /**
+ * @throws RuntimeException if the bounds are exceeded.
+ */
+ private void checkBounds(int cellNum) {
+ if (cellNum > 255) {
+ throw new RuntimeException("You cannot have more than 255 columns "+
+ "in a given row (IV). Because Excel can't handle it");
+ }
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>