You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2008/08/17 13:08:47 UTC

DO NOT REPLY [Bug 45639] New: ArrayIndexOutOfBoundsException in the HSSFSheet.groupColumn

https://issues.apache.org/bugzilla/show_bug.cgi?id=45639

           Summary: ArrayIndexOutOfBoundsException  in the
                    HSSFSheet.groupColumn
           Product: POI
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: asharapov@tengry.com


This is the exception that occurs when i try to group columns on sheet:
java.lang.ArrayIndexOutOfBoundsException: -2
        at java.util.ArrayList.get(ArrayList.java:323)
        at
org.apache.poi.hssf.record.aggregates.ColumnInfoRecordsAggregate.getColInfo(ColumnInfoRecordsAggregate.java:151)
        at
org.apache.poi.hssf.record.aggregates.ColumnInfoRecordsAggregate.collapseColInfoRecords(ColumnInfoRecordsAggregate.java:448)
        at
org.apache.poi.hssf.record.aggregates.ColumnInfoRecordsAggregate.groupColumnRange(ColumnInfoRecordsAggregate.java:492)
        at org.apache.poi.hssf.model.Sheet.groupColumnRange(Sheet.java:1194)
        at
org.apache.poi.hssf.usermodel.HSSFSheet.groupColumn(HSSFSheet.java:1596)

example code:
        final HSSFWorkbook wb = new HSSFWorkbook();
        final HSSFSheet sheet = wb.createSheet("test");
        sheet.groupColumn((short)7, (short)9);
        sheet.groupColumn((short)4, (short)12);
        sheet.groupColumn((short)1, (short)15);

Tested on current poi version (poi-3.2-alpha1-20080817)


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 45639] ArrayIndexOutOfBoundsException in the HSSFSheet.groupColumn

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45639





--- Comment #1 from Olaf Diehl <O....@proPlant.de>  2008-09-10 06:09:44 PST ---
A simple patch is to comment out the performance tuning with fromIdx in
ColumnInfoRecordsAggregate.groupColumnRange(short fromColumn, short toColumn,
boolean indent). It does not work because the column records are NOT ordered by
column no:

// taken from 3.1 FINAL
org.apache.poi.hssf.record.aggregates.ColumnInfoRecordsAggregate:

    public void groupColumnRange(short fromColumn, short toColumn, boolean
indent)
    {
      ...
// OD bug fix: records NOT ordered by column no
//                fromIdx = columnIdx - 1; // subtract 1 just in case this
column is collapsed later.
      ...
    }


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 45639] ArrayIndexOutOfBoundsException in the HSSFSheet.groupColumn

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45639


Josh Micich <jo...@gildedtree.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #2 from Josh Micich <jo...@gildedtree.com>  2008-09-11 16:24:52 PST ---
fixed in svn 694534.

As you pointed out, the ColumnInfoRecords were not being kept in proper order. 
Rather than disable the optimisation, I fixed the logic to keep the records
sorted.  There were a few other methods besides groupColumnRange() that relied
on proper ordering.

Junit added for groupColumnRange() and collapseColumn()/expandColumn() 


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org