poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Height, Jason" <jhei...@subcorp.com.au>
Subject RE: Bug + fix
Date Fri, 24 Sep 2004 01:38:19 GMT
Manjuka,

Actually your fix doesn't look quite "right". I have usually found that
these kind of problems are caused by some other records up stream
reporting their size incorrectly. And therefore the downstream records
getting all mixed up by that byte offset.

If possible would you be able to create a bugzilla report and attach an
example spreadsheet and the code to reproduce the bug. 

Maybe you could have a further look if possible.

Jason

-----Original Message-----
From: Manjuka Soysa [mailto:Manjuka.Soysa@colesmyer.com.au] 
Sent: Friday, 24 September 2004 10:50 AM
To: 'poi-dev@jakarta.apache.org'
Subject: Bug + fix


Hi,
I had a problem parsing some spreadsheets that had filters at the top
(combo-box type dropdowns).
Calling HSSFWorkbook constructor was throwing an array out of bounds
exception.
I traced the problem to UnknownRecord constructor. I have attached the
fix.
Old code:
    public UnknownRecord( short id, short size, byte[] data, int offset
)
    {
        sid     = id;
        thedata = new byte[size];
        
        System.arraycopy(data, offset, thedata, 0, size);
    }

Fix:
    public UnknownRecord( short id, short size, byte[] data, int offset
)
    {
        sid     = id;
        thedata = new byte[size];
        
        int copyLength = Math.min(size, data.length - offset);
        
        System.arraycopy(data, offset, thedata, 0, copyLength);
    }

cheers,
Manjuka

This email and any attachments may contain privileged and confidential
information and are intended for the named addressee only. If you have
received this e-mail in error, please notify the sender and delete this
e-mail immediately. Any confidentiality, privilege or copyright is not
waived or lost because this e-mail has been sent to you in error. It is
your responsibility to check this e-mail and any attachments for
viruses.  No warranty is made that this material is free from computer
virus or any other defect or error.  Any loss/damage incurred by using
this material is not the sender's responsibility.  The sender's entire
liability will be limited to resupplying the material.

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


--------------------------------------------------------------------------------------------------------------------
This e-mail (including attachments) is confidential information of Australian Submarine Corporation
Pty Limited (ASC).  It may also be legally privileged.  Unauthorised use and disclosure is
prohibited.  ASC is not taken to have waived confidentiality or privilege if this e-mail was
sent to you in error. If you have received it in error, please notify the sender promptly.
 While ASC takes steps to identify and eliminate viruses, it cannot confirm that this e-mail
is free from them.  You should scan this e-mail for viruses before it is used.  The statements
in this e-mail are those of the sender only, unless specifically stated to be those of ASC
by someone with authority to do so.


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


Mime
View raw message