poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 61374] this exception should never happen, if you read this message please send a mail to the developers team.
Date Wed, 02 Aug 2017 17:07:01 GMT

--- Comment #1 from Javen O'Neal <onealj@apache.org> ---
A few suggestions for your code:
> for (int rowIndex=0; rowIndex <= sheet.getLastRowNum(); rowIndex++) {
>     Row row = sheet.getRow(rowIndex);
>     if (row != null) {
>         ...
>     }
can be replaced with
> for (final Row row : sheet) {
>     ...
> }
which will iterate over all non-null rows. That'll save you one indentation
layer and improve readability.

You can close inputStream as soon as you're done opening the workbook. This may
help with memory consumption. If you aren't reading from an embedded resource,
it's even better to read straight from a File, which avoids buffering the
contents of the file in memory prior to initializing the workbook.

Addressing the issue at hand, based on your stack trace, it looks like  your
issue arises from `new XSSFWorkbook(inputStream)`, so the rest of the example
code is irrelevant. If this is correct, then the minimum test case that would
reproduce the issue would look something like this:

private void parseXlsRDP(String fileName) {
    Properties p = System.getProperties();

    InputStream inputStream = getClass().getResourceAsStream(fileName); 
    XSSFWorkbook wb = new XSSFWorkbook(inputStream);

I don't have access to a CICS system to be able to test this issue, nor do I
have the file you used that produced the problem, so I'll need your help to
resolve this issue.
1) Does this problem occur with certain files or all XLSX files on CICS? Could
you try with a file that is known to work with POI, such as
2) Does this problem occur when reading non-Excel OOXML file formats (docx,
3) Does my guess at the minimum reproducing code reproduce your issue? Is
setting the file.encoding system property required to reproduce the issue?
4) If you open the XSSFWorkbook from a java.io.FileInputStream or java.io.File
rather than a resource InputStream, does the problem still occur?
5) Does the problem occur if you open the workbook from

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

View raw message