https://issues.apache.org/bugzilla/show_bug.cgi?id=56957

--- Comment #2 from Dominik Stadler <[email protected]> ---
The problem is that the original xlsx does not contain a file for the
SharedString table in the zip-file and thus an empty string table is created
during loading the file initially.

During close(), the file is written back and a 0-byte sharedStrings.xml file is
created, which later fails during loading the xlsx again.

I tried it with the following change, which makes this test work, however I am
not sure if this is the correct way to exclude parts which do not have any
size:

---
a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/marshallers/ZipPartMarshaller.java
+++
b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/marshallers/ZipPartMarshaller.java
@@ -63,6 +63,11 @@ public final class ZipPartMarshaller implements
PartMarshaller {
                        // Normally should happen only in developement phase,
so just throw
                        // exception
                }
+
+               // check if there is anything to save
+               if(part.getSize() == 0) {
+                   return true;
+               }

                ZipOutputStream zos = (ZipOutputStream) os;
                ZipEntry partEntry = new ZipEntry(ZipHelper

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Reply via email to