fix for bug 9114, reported and fix pointed by Tal Moshaiov
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352646 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f75fb848ba
commit
5fef5940be
@ -59,7 +59,8 @@ import org.apache.poi.hssf.record.Record;
|
|||||||
import org.apache.poi.hssf.record.RowRecord;
|
import org.apache.poi.hssf.record.RowRecord;
|
||||||
import org.apache.poi.hssf.record.UnknownRecord;
|
import org.apache.poi.hssf.record.UnknownRecord;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -73,14 +74,15 @@ public class RowRecordsAggregate
|
|||||||
{
|
{
|
||||||
int firstrow = -1;
|
int firstrow = -1;
|
||||||
int lastrow = -1;
|
int lastrow = -1;
|
||||||
HashMap records = null;
|
Map records = null;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
/** Creates a new instance of ValueRecordsAggregate */
|
/** Creates a new instance of ValueRecordsAggregate */
|
||||||
|
|
||||||
public RowRecordsAggregate()
|
public RowRecordsAggregate()
|
||||||
{
|
{
|
||||||
records = new HashMap();
|
records = new TreeMap();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertRow(RowRecord row)
|
public void insertRow(RowRecord row)
|
||||||
@ -216,4 +218,6 @@ public class RowRecordsAggregate
|
|||||||
{
|
{
|
||||||
return records.values().iterator();
|
return records.values().iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package org.apache.poi.hssf.record.aggregates;
|
||||||
|
|
||||||
|
import org.apache.poi.hssf.record.*;
|
||||||
|
|
||||||
|
public class TestRowRecordsAggregate extends junit.framework.TestCase {
|
||||||
|
public TestRowRecordsAggregate(String name) {
|
||||||
|
super (name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testRowGet() {
|
||||||
|
RowRecordsAggregate rra = new RowRecordsAggregate();
|
||||||
|
RowRecord rr = new RowRecord();
|
||||||
|
rr.setRowNumber(( short ) 4);
|
||||||
|
rra.insertRow(rr);
|
||||||
|
RowRecord rr2 = new RowRecord(); rr2.setRowNumber((short) 1);
|
||||||
|
rra.insertRow(rr2);
|
||||||
|
|
||||||
|
RowRecord rr1 = rra.getRow(4);
|
||||||
|
|
||||||
|
assertTrue("Row Record should not be null", rr1!=null);
|
||||||
|
assertTrue("Row number is 1",rr1.getRowNumber() == 4);
|
||||||
|
assertTrue("Row record retrieved is identical ", rr1 == rr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String [] args) {
|
||||||
|
System.out
|
||||||
|
.println("Testing org.apache.poi.hssf.record.aggregates.RowRecordAggregate");
|
||||||
|
junit.textui.TestRunner.run(TestRowRecordsAggregate.class);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user