You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2008/10/03 07:27:12 UTC
svn commit: r701302 - in /poi/trunk/src:
documentation/content/xdocs/changes.xml
documentation/content/xdocs/status.xml
scratchpad/src/org/apache/poi/hslf/model/Table.java
scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java
Author: yegor
Date: Thu Oct 2 22:27:06 2008
New Revision: 701302
URL: http://svn.apache.org/viewvc?rev=701302&view=rev
Log:
fixed bug #45889:rrayIndexOutOfBoundsException when constructing HSLF Table with a single row
Modified:
poi/trunk/src/documentation/content/xdocs/changes.xml
poi/trunk/src/documentation/content/xdocs/status.xml
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Table.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java
Modified: poi/trunk/src/documentation/content/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/changes.xml?rev=701302&r1=701301&r2=701302&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/changes.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/changes.xml Thu Oct 2 22:27:06 2008
@@ -37,6 +37,8 @@
<!-- 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>
Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=701302&r1=701301&r2=701302&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Thu Oct 2 22:27:06 2008
@@ -34,6 +34,8 @@
<!-- 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>
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Table.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Table.java?rev=701302&r1=701301&r2=701302&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Table.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Table.java Thu Oct 2 22:27:06 2008
@@ -53,6 +53,9 @@
public Table(int numrows, int numcols) {
super();
+ if(numrows < 1) throw new IllegalArgumentException("The number of rows must be greater than 1");
+ if(numcols < 1) throw new IllegalArgumentException("The number of columns must be greater than 1");
+
int x=0, y=0, tblWidth=0, tblHeight=0;
cells = new TableCell[numrows][numcols];
for (int i = 0; i < cells.length; i++) {
@@ -165,11 +168,11 @@
Rectangle anchor = sh[i].getAnchor();
if(anchor.y != y0){
y0 = anchor.y;
- if(row != null) maxrowlen = Math.max(maxrowlen, row.size());
row = new ArrayList();
lst.add(row);
}
row.add(sh[i]);
+ maxrowlen = Math.max(maxrowlen, row.size());
}
}
cells = new TableCell[lst.size()][maxrowlen];
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java?rev=701302&r1=701301&r2=701302&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java Thu Oct 2 22:27:06 2008
@@ -60,4 +60,40 @@
assertEquals(tbl.getNumberOfRows(), tbl3.getNumberOfRows());
}
+ /**
+ * Error constructing Table when rownum=1
+ */
+ public void test45889(){
+ SlideShow ppt = new SlideShow();
+ Slide slide = ppt.createSlide();
+ Shape[] shapes;
+ Table tbl1 = new Table(1, 5);
+ assertEquals(5, tbl1.getNumberOfColumns());
+ assertEquals(1, tbl1.getNumberOfRows());
+ slide.addShape(tbl1);
+
+ shapes = slide.getShapes();
+ assertEquals(1, shapes.length);
+
+ Table tbl2 = (Table)shapes[0];
+ assertSame(tbl1.getSpContainer(), tbl2.getSpContainer());
+
+ assertEquals(tbl1.getNumberOfColumns(), tbl2.getNumberOfColumns());
+ assertEquals(tbl1.getNumberOfRows(), tbl2.getNumberOfRows());
+ }
+
+ public void testIllegalCOnstruction(){
+ try {
+ Table tbl = new Table(0, 5);
+ fail("Table(rownum, colnum) must throw IllegalArgumentException if any of tghe arguments is less than 1");
+ } catch (IllegalArgumentException e){
+
+ }
+ try {
+ Table tbl = new Table(5, 0);
+ fail("Table(rownum, colnum) must throw IllegalArgumentException if any of tghe arguments is less than 1");
+ } catch (IllegalArgumentException e){
+
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org