poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 51444] New: Writing XSSF to stream produces unreadable content when XSSF is read from stream
Date Tue, 28 Jun 2011 09:51:50 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=51444

             Bug #: 51444
           Summary: Writing XSSF to stream produces unreadable content
                    when XSSF is read from stream
           Product: POI
           Version: 3.7
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: milan.chudik@mapflow.com
    Classification: Unclassified


Created attachment 27221
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27221
Junit test file, workbook.xls,workbook.xlsx

hi,

I just experience strange fact that is similar to bug 51158, but not really the
same.

When I create workbook "by hand" via new operator, I can store XSSFWorkbook to
a file(outputstream), that works ok(I don't need to store it twice-though it
yields error too)
But when I read a workbook from a stream, let's say file, and store it to
another file, virtually creating a copy, then the result file is unreadable.

Use case is, that I want to report only one sheet(current) I'm working on, then
I create a XSSFWorkbook from InputStream, remove unnecessary sheets and then
store it via write method to a new OutStream and passes that stream further for
processing. BUT this stream is unreadable, if I want to read from this stream I
get this exception:

ava.lang.NullPointerException
        at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:256)
        at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:186)
        at
org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:182)
        at
org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:63)

If I write it to a file, file is unreadable.
I debugged it it I find out, that writing fails on "Dublicate entry:
docProps/core.xml" in I think DefaultMarshaller(exception is caught in
org.apache.poi.openxml4j.opc.ZipPackage.saveImpl)

I attach test file that demonstrates issues and example excel files.

I experience this error both in 3.7 and 3.8-beta3
Regards,

Milan

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


Mime
View raw message