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

           Summary: constructor call HSSFWorkbook(POIFSFileSystem) ->
                    IndexOutOfBoundsException / InvocationTargetException
           Product: POI
           Version: 2.5
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: HSSF
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]
 BugsThisDependsOn: 31114,33082


We decided to create this new bug, although we found bug 31114 and bug 33082
which describe similar problems.


On execution of the following code snippet:

POIFSFileSystem fs = new POIFSFileSystem(request.getServletContext
().getResourceAsStream("WEB-INF/workbook.xls"));
HSSFWorkbook wb = new HSSFWorkbook (fs);

...
we get an InvocationTargetException for the createRecord method-call (else
block: retval = new UnknownRecord(rectype, size, data);)  in class
org.apache.poi.hssf.record.RecordFactory.

On analysing this call, we found an IndexOutOfBoundsException. The Exception is
thrown on execution of System.arraycopy().

While remote-debugging this scenario: Starting at constructor call till
execution of the arraycopy statement, there was nothing abnormal. 


But on execution of the arraycopy statement, we found the following:

public static void arraycopy( byte[] src, int src_position, byte[] dst, int
dst_position, int length)

- The parameter length did'nt match the available size of parameter src. By
patching the parameter length to: length=Math.min (length,
Math.min(src.length-src_position, dst.length-dst_position)); - we were able to
load the workbook. 

We don't know why in this case these parameters are inconsitent to each other,
but we want to request for help. In the attachment you'll find our patching
class as an proposal solution. 

thx for your help!

-- 
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: [EMAIL PROTECTED]
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/

Reply via email to