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 2006/12/09 03:23:05 UTC

DO NOT REPLY [Bug 41139] New: - Constructing HSSFWorkbook is failed,threw ArrayIndexOutOfBoundsException for creating UnknownRecord

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41139>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41139

           Summary: Constructing HSSFWorkbook is failed,threw
                    ArrayIndexOutOfBoundsException for creating
                    UnknownRecord
           Product: POI
           Version: 2.5
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: zealz@cn.lenovo.com


1)Following is the detail excepion
[WARNING] Unknown Ptg 2d (45)
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown 
Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown 
Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at org.apache.poi.hssf.record.RecordFactory.createRecord
(RecordFactory.java:224)
	at org.apache.poi.hssf.record.RecordFactory.createRecords
(RecordFactory.java:160)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:163)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:130)
	at test.Test.parsingToRawContent(Test.java:70)
	at test.Test.main(Test.java:313)
Caused by: java.lang.ArrayIndexOutOfBoundsException
	at java.lang.System.arraycopy(Native Method)
	at org.apache.poi.hssf.record.UnknownRecord.<init>
(UnknownRecord.java:62)
	at org.apache.poi.hssf.record.SubRecord.createSubRecord
(SubRecord.java:57)
	at org.apache.poi.hssf.record.ObjRecord.fillFields(ObjRecord.java:99)
	at org.apache.poi.hssf.record.Record.fillFields(Record.java:90)
	at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
	at org.apache.poi.hssf.record.ObjRecord.<init>(ObjRecord.java:61)
	... 10 more
Exception in thread "main" org.apache.poi.hssf.record.RecordFormatException: 
Unable to construct record instance, the following exception occured: null
	at org.apache.poi.hssf.record.RecordFactory.createRecord
(RecordFactory.java:237)
	at org.apache.poi.hssf.record.RecordFactory.createRecords
(RecordFactory.java:160)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:163)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:130)
	at test.Test.parsingToRawContent(Test.java:70)
	at test.Test.main(Test.java:313)
---------------------------------------------------------------
My code is quite simple:
POIFSFileSystem fs      =
            new POIFSFileSystem(new FileInputStream(fileName));
HSSFWorkbook wb = new HSSFWorkbook(fs);

2)While I use the old version of POI to parse same excel file,
although it will display warning message like "[WARNING] Unknown Ptg 2d (45)"
but at least it can parse the content, but It looks like that it always threw 
OutOfMemoryError while parsing the large xls file.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


DO NOT REPLY [Bug 41139] - Constructing HSSFWorkbook is failed,threw ArrayIndexOutOfBoundsException for creating UnknownRecord

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41139>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41139


yegor@dinom.ru changed:

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




------- Additional Comments From yegor@dinom.ru  2008-01-19 06:53 -------
Works with POI-3.0.2-BETA2.

Regards,
Yegor

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

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


DO NOT REPLY [Bug 41139] - Constructing HSSFWorkbook is failed,threw ArrayIndexOutOfBoundsException for creating UnknownRecord

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41139>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41139





------- Additional Comments From steveknoll@yahoo.com  2007-04-03 14:00 -------
I have run into the same bug (UnknownRecord throwing an
ArrayIndexOutOfBoundsException), and here is a possible solution
Change the 3rd constructor to read:
    public UnknownRecord( short id, short size, byte[] data, int offset )
    {
        sid     = id;

        // ObjRecord's fillFields was getting an obviously wrong subRecordSize,
        // which it passes to SubRecord.createSubRecord, which passes the value
        // here as "size".
        //
        // Instead of allowing an ArrayIndexOutOfBoundsException 
        //   to happen, let's change the size if appropriate.
        if ( size > (data.length - offset) ) {
          size = (short)(data.length - offset);
        }

        thedata = new byte[size];

        System.arraycopy(data, offset, thedata, 0, size);
    }
It could be argued that this is just patching the real problem; the real
problem is that we have bogus length/size for some Unknown record type
in Excel.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


DO NOT REPLY [Bug 41139] - Constructing HSSFWorkbook is failed,threw ArrayIndexOutOfBoundsException for creating UnknownRecord

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41139>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41139





------- Additional Comments From zealz@cn.lenovo.com  2006-12-08 18:35 -------
Created an attachment (id=19234)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=19234&action=view)
The testing xls file which cause exception


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

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/