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/07/05 20:18:40 UTC

DO NOT REPLY [Bug 39970] New: - ArrayIndexOutOfBoundsException when opening EXCEL file

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=39970>.
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=39970

           Summary: ArrayIndexOutOfBoundsException when opening EXCEL file
           Product: POI
           Version: 2.5
          Platform: All
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P5
         Component: HSSF
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: visu5678@yahoo.com


ArrayIndexOutOfBoundsException Occured when opening EXCEL file that contains 
values in such a way that some values span to other columns but some doesn't 
span to other columns is display.

The error stacktrace is-

java.lang.reflect.InvocationTargetException: 
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(Compiled 
Code))
	at org.apache.poi.hssf.record.Record.<init>(Record.java(Compiled Code))
	at org.apache.poi.hssf.record.ObjRecord.<init>(ObjRecord.java:61)
	at java.lang.reflect.Constructor.newInstance(Native Method)
	at org.apache.poi.hssf.record.RecordFactory.createRecord
(RecordFactory.java(Compiled Code))
	at org.apache.poi.hssf.record.RecordFactory.createRecords
(RecordFactory.java(Compiled Code))
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:163)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:210)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:191)
	at com.mastercard.mcideas.atmdir.util.ExcelUtil.openWorkBook
(ExcelUtil.java:263)
	at com.mastercard.mcideas.atmdir.util.ExcelUtil.TestReadingWorkBook
(ExcelUtil.java:399)
	at com.mastercard.mcideas.atmdir.util.ExcelUtil.main
(ExcelUtil.java:318)

The problem is with System.arrayCopy() method call in UnknownRecord class. A 
fix can be applied to this problem as follows (By making sure the array 
doesn't go beyond limits)


 public UnknownRecord( short id, short size, byte[] data, int offset )
    {
        sid     = id;
        thedata = new byte[size];
        
        if((data.length - offset) < size)
		size = (short)(data.length - offset);
        
        
        System.arraycopy(data, offset, thedata, 0, size);
    }

-- 
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 39970] - ArrayIndexOutOfBoundsException when opening EXCEL file

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=39970>.
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=39970


jheight@apache.org changed:

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




------- Additional Comments From jheight@apache.org  2006-07-26 12:00 -------
Completely invalid bug, if there is an excel file that is generating this
exception then upload/attach it to a bug report. 

Feel free to repoen this bug, if you can upload the excel causing the troyble.

Jason

-- 
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/