Hi,
I'm noticing some strange behaviour in the OPCPackage.open method when
trying to open very large XLSX file. The file in question is 25mb, but if
you unzip the contents it's > 250mb.

The following line works: 
XSSFReader r = new XSSFReader(OPCPackage.open("/some/large/file.xlsx"));

However, this line doesn't work:
XSSFReader r = new XSSFReader(OPCPackage.open(new FileInputStream(new
File("/some/large/file.xlsx"))));

It breaks with an OOME:

java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOf(Arrays.java:2786)
        at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
        at
org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource$FakeZipEntry.<init>(ZipInputStreamZipEntrySource.java:115)
        at
org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource.<init>(ZipInputStreamZipEntrySource.java:55)
        at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:82)
        at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:220)

Apparently the openxml4j code can handle the file, just not when it's
presented as an inputstream. My problem is that, in my code, I can't get at
the file, and have to use the inputstream. So how do I prevent it from
throwing an OOME whilst still using the inputstream?

I'm using POI 3.6 on JDK 1.6.

Thanks in advance,
Maarten
-- 
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/Strange-behaviour-in-OPCPackage-open-tp3228772p3228772.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to