<!-- Don't forget to update status.xml too! -->
<release version="3.2-alpha1" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">45889 - fixed ArrayIndexOutOfBoundsException when constructing HSLF Table with a single row </action>
+ <action dev="POI-DEVELOPERS" type="add">Initial support for creating hyperlinks in HSLF</action>
<action dev="POI-DEVELOPERS" type="fix">45876 - fixed BoundSheetRecord to allow sheet names longer than 31 chars</action>
<action dev="POI-DEVELOPERS" type="add">45890 - fixed HSSFSheet.shiftRows to also update conditional formats</action>
<action dev="POI-DEVELOPERS" type="add">45865 modified Formula Parser/Evaluator to handle cross-worksheet formulas</action>
<!-- Don't forget to update changes.xml too! -->
<changes>
<release version="3.2-alpha1" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">45889 - fixed ArrayIndexOutOfBoundsException when constructing HSLF Table with a single row </action>
+ <action dev="POI-DEVELOPERS" type="add">Initial support for creating hyperlinks in HSLF</action>
<action dev="POI-DEVELOPERS" type="fix">45876 - fixed BoundSheetRecord to allow sheet names longer than 31 chars</action>
<action dev="POI-DEVELOPERS" type="add">45890 - fixed HSSFSheet.shiftRows to also update conditional formats</action>
<action dev="POI-DEVELOPERS" type="add">45865 modified Formula Parser/Evaluator to handle cross-worksheet formulas</action>
public Table(int numrows, int numcols) {\r
super();\r
\r
+ if(numrows < 1) throw new IllegalArgumentException("The number of rows must be greater than 1");\r
+ if(numcols < 1) throw new IllegalArgumentException("The number of columns must be greater than 1");\r
+\r
int x=0, y=0, tblWidth=0, tblHeight=0;\r
cells = new TableCell[numrows][numcols];\r
for (int i = 0; i < cells.length; i++) {\r
Rectangle anchor = sh[i].getAnchor();\r
if(anchor.y != y0){\r
y0 = anchor.y;\r
- if(row != null) maxrowlen = Math.max(maxrowlen, row.size());\r
row = new ArrayList();\r
lst.add(row);\r
}\r
row.add(sh[i]);\r
+ maxrowlen = Math.max(maxrowlen, row.size());\r
}\r
}\r
cells = new TableCell[lst.size()][maxrowlen];\r
assertEquals(tbl.getNumberOfRows(), tbl3.getNumberOfRows());\r
}\r
\r
+ /**\r
+ * Error constructing Table when rownum=1\r
+ */\r
+ public void test45889(){\r
+ SlideShow ppt = new SlideShow();\r
+ Slide slide = ppt.createSlide();\r
+ Shape[] shapes;\r
+ Table tbl1 = new Table(1, 5);\r
+ assertEquals(5, tbl1.getNumberOfColumns());\r
+ assertEquals(1, tbl1.getNumberOfRows());\r
+ slide.addShape(tbl1);\r
+\r
+ shapes = slide.getShapes();\r
+ assertEquals(1, shapes.length);\r
+\r
+ Table tbl2 = (Table)shapes[0];\r
+ assertSame(tbl1.getSpContainer(), tbl2.getSpContainer());\r
+\r
+ assertEquals(tbl1.getNumberOfColumns(), tbl2.getNumberOfColumns());\r
+ assertEquals(tbl1.getNumberOfRows(), tbl2.getNumberOfRows());\r
+ }\r
+\r
+ public void testIllegalCOnstruction(){\r
+ try {\r
+ Table tbl = new Table(0, 5);\r
+ fail("Table(rownum, colnum) must throw IllegalArgumentException if any of tghe arguments is less than 1");\r
+ } catch (IllegalArgumentException e){\r
+\r
+ }\r
+ try {\r
+ Table tbl = new Table(5, 0);\r
+ fail("Table(rownum, colnum) must throw IllegalArgumentException if any of tghe arguments is less than 1");\r
+ } catch (IllegalArgumentException e){\r
+\r
+ }\r
+ }\r
}\r